Extension:Cognate/ko
출시 상태: 안정 |
|
|---|---|
| 구현 | 데이터베이스 |
| 설명 | Link different language versions of a page by using the page title. |
| 만든 이 | Gabriel Birke, Addshore |
| 최신 버전 | Continuous updates |
| 호환성 정책 | 스냅샷은 미디어위키와 함께 릴리스됩니다. Master is not backward compatible. |
| MediaWiki | 1.29+ |
| 데이터베이스 변경 | 예 |
| 가상 도메인 | virtual-cognate |
|
|
| Licence | GNU General Public License 2.0 or later |
| 다운로드 | |
| Cognate 확장 기능 번역 (translatewiki.net에서 가능한 경우) | |
| 이슈 | 미해결 작업 · 버그 보고 |
The Cognate extension creates a central store where the page titles for a group of sites are stored. It can then generate interwiki links across wiki projects in cases where the titles are the same. It was developed to solve the "Centralize interwiki language links for Wiktionary" task.
"Cognate" is a linguistic concept, referring to words in different languages developed from the same origin. This means that this extension is misnamed—since this extension links pages with the same title across wikis, a proper name would be “Homograph”.
Assumptions and restrictions
- Pages must be in one of the standard MediaWiki namespaces.
- Page titles are the same across languages (with some simple normalization applied).
- Sites should have the same interwiki structure for language links.
- Pages should not contain inter language links in wikitext as these will override the link provided by Cognate.
- Unexpected hash conflicts are unlikely but could occur, and would result in unexpected language links.
How it works
Title Normalization
Very simple title normalization (reduction to ASCII) occurs within the extension. This can be seen in the StringNormalizer class.
Initially the amount of normalization is very small. Requests can be made to expand this and will be added on a case by case basis.
| String | Normalized | Notes |
|---|---|---|
Hello…
|
Hello...
|
The raw string contains an ellipsis character. This is normalized to three . characters |
lepelle’
|
lepelle'
|
The normalized string has a normalized apostrophe. |
Title Hashing
Titles are hashed using sha256. This can be seen in the StringHasher class.
Part of the hash is then stored in the database in a BIG_INT field for efficient lookups.
There are roughly 18,446,744,073,709,551,615 possible values.
| String | Hash | Int |
|---|---|---|
A
|
559AEAD08264D5795D3909718CDD05ABD49572E84FE55590EEF31A88A08FDFFD | 6168500820899059065 |
Foo
|
1CBEC737F863E4922CEE63CC2EBBFAAFCD1CFF8B790D8CFD2E6A5D550B648AFA | 2071311921841431698 |
1234567890
|
C775E7B757EDE630CD0AA1113BD102661AB38829CA52A6422AB782862F268646 | -4074095513246505424 |
Matching Hashes
As titles that require links are assumed to be the same post normalization, they will result in the same hash and thus the same Int stored in the database.
Some sample data might look as follows when loading the "Foo..." page on enwiktionary.
| Wiki | Title | Hash Int | Normalized Hash Int | Notes |
|---|---|---|---|---|
| enwiktionary | Foo...
|
395730596998145766 | 395730596998145766 | Matched row |
| frwiktionary | Foo…
|
-7435652355441782233 | 395730596998145766 | Matched row, even though the pre normalized title includes the ellipsis character. |
| dewiktionary | Foo...
|
395730596998145766 | 395730596998145766 | Matched row |
| arwiktionary | Foo
|
2071311921841431698 | 2071311921841431698 |
Overwriting
It is possible to overwrite the automatic links provided by Cognate, simply by adding one or more interwiki links in the page.
That also means that to make Cognate work when the extension is deployed, the pages should not contain inter language links in their wikitext.
Testing

The extension can be tested on beta wiktionary sites:
- https://en.wiktionary.beta.wmflabs.org/wiki/Wiktionary:Main_Page
- https://de.wiktionary.beta.wmflabs.org/wiki/Hauptseite
- https://he.wiktionary.beta.wmflabs.org/wiki/%D7%A2%D7%9E%D7%95%D7%93_%D7%A8%D7%90%D7%A9%D7%99
These sites are linked together using the Cognate extension.
설치
- 파일을 다운로드하고
Cognate폴더를extensions/디렉토리에 넣어 주세요.
개발자와 코딩 기여자는 Git을 이용해 확장기능을 다운받는 것이 좋습니다.cd extensions/ git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/Cognate
- 아래의 코드를 LocalSettings.php 코드의 마지막에 추가합니다.
wfLoadExtension( 'Cognate' ); # Settings used in WMF production # Use the external cluster 'extension1' and dbname 'cognate_wiktionary' $wgCognateDb = 'cognate_wiktionary'; $wgCognateCluster = 'extension1'; # Only work on the main namespace $wgCognateNamespaces = [ 0 ];
- 갱신 스크립트를 실행합니다. 이 스크립트는 이 확장기능을 필요로 하는 데이터 베이스 테이블을 자동적으로 작성합니다.
완료 – 위키의 ‘Special:Version’에 이동해서, 확장기능이 올바르게 설치된 것을 확인합니다.
- Populate the
sitestable by running the populateCognateSites.php maintenance script. Sites must already exist in the MediaWiki sites table with the correct groupings.
php maintenance/run.php ./extensions/Cognate/maintenance/populateCognateSites.php --site-group=wiktionary
- Populate the page and title tables by running the populateCognatePages.php maintenance script.
php maintenance/run.php ./extensions/Cognate/maintenance/populateCognatePages.php
| 이 확장 기능은 하나 이상의 위키미디어 프로젝트에서 사용 중입니다. 이것은 아마도 이 확장 기능이 안정적이고 트래픽이 많은 웹 사이트에서 사용할 수 있을 만큼 충분히 잘 작동한다는 것을 의미합니다. 설치된 위치를 확인하려면 위키미디어의 CommonSettings.php 및 InitialiseSettings.php 구성 파일에서 이 확장 기능의 이름을 찾습니다. 특정 위키에 설치된 확장 기능의 전체 목록은 위키의 Special:Version 문서에서 볼 수 있습니다. |
- Stable extensions/ko
- Database extensions/ko
- ArticleUndelete extensions/ko
- ContentAlterParserOutput extensions/ko
- LoadExtensionSchemaUpdates extensions/ko
- PageMoveComplete extensions/ko
- PageSaveComplete extensions/ko
- WikiPageDeletionUpdates extensions/ko
- GPL licensed extensions/ko
- Extensions in Wikimedia version control/ko
- All extensions/ko
- Extensions used on Wikimedia/ko
- Interwiki extensions/ko
