Skip to content

Commit

Permalink
Release 1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
MarvNC committed Jan 4, 2024
1 parent 1deba23 commit 753720e
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
"singleQuote": true,
"useTabs": false,
"proseWrap": "always"
}
}
4 changes: 3 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@ more Yomitan dictionaries and tools, see

## Download

**2024-01-04 Version 1.3**: More reading filtering for JA Wikipedia.

**2023-12-23 Version 1.2**: Improved parsing of more readings for the JA
Wikipedia release.

**2023-12-21 Version 1.1**: Updated script for better parsing of readings.

- **[Download JA Wikipedia for Yomitan](https://drive.google.com/file/d/1BZ7vhkwN5eEWVCNU6yVRZq8djsHH0VMj/view?usp=drive_link)**
- **[Download JA Wikipedia for Yomitan](https://drive.google.com/open?id=14ZxYKI2JQ8QTpWTtNSH-TXu7wtMODcYB&usp=drive_fs)**
(~1.2M entries)
- **[Download ZH Wikipedia for Yomitan](https://drive.google.com/open?id=14ZECT8FVl0KjxV3JPhzgdmIV8GEgx5ht&usp=drive_fs)**
(~1.2M entries)
Expand Down
2 changes: 1 addition & 1 deletion src/constants.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const languagesAllowed = {
ja: 'JA',
zh: 'ZH',
};
};
25 changes: 13 additions & 12 deletions src/convertWikipedia.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@ import { languagesAllowed } from './constants.js';

const linkCharacter = '⧉';
/**
*
* @param {string} lang
* @param {string} date
* @param {string} version
* @returns
*
* @param {string} lang
* @param {string} date
* @param {string} version
* @returns
*/
const outputZipName = (lang, date, version) => `${lang} Wikipedia [${date}] (v${version}).zip`;
const outputZipName = (lang, date, version) =>
`${lang} Wikipedia [${date}] (v${version}).zip`;
const shortAbstractFile = (lang) =>
`short-abstracts_lang=${lang.toLowerCase()}.ttl`;

Expand All @@ -35,7 +36,7 @@ const shortAbstractFile = (lang) =>

const dict = new Dictionary({
// @ts-ignore
fileName: outputZipName(lang),
fileName: outputZipName(lang, date, version),
});

let processedLines = 0;
Expand Down Expand Up @@ -79,7 +80,7 @@ div.gloss-sc-div[data-sc-wikipedia=term-specifier] {
function processLine(line, dict, lang) {
const { term, termSlug, termSpecifier, reading, definition } = parseLine(
line,
lang
lang,
);

const termEntry = new TermEntry(term);
Expand Down Expand Up @@ -131,8 +132,8 @@ function processLine(line, dict, lang) {
lang === languagesAllowed.ja
? '続きを読む'
: lang === languagesAllowed.zh
? '查看更多'
: 'Read more';
? '查看更多'
: 'Read more';
/**
* @type {import('yomichan-dict-builder/dist/types/yomitan/termbank').StructuredContentNode}
*/
Expand Down Expand Up @@ -174,8 +175,8 @@ function readArgs() {
if (!languagesAllowed[langInput.toLowerCase()]) {
throw new Error(
`Language ${langInput} is not allowed. Allowed languages: ${Object.keys(
languagesAllowed
).join(', ')}`
languagesAllowed,
).join(', ')}`,
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/parseLine.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function parseLine(line, lang) {
// remove last 6 characters
line = line.slice(0, -6);
const [resource, definition] = line.split(
'> <http://www.w3.org/2000/01/rdf-schema#comment> "'
'> <http://www.w3.org/2000/01/rdf-schema#comment> "',
);
let termSlug = resource.split('.dbpedia.org/resource/').pop();
if (!termSlug) {
Expand Down

0 comments on commit 753720e

Please sign in to comment.