Skip to content

Commit

Permalink
configure node
Browse files Browse the repository at this point in the history
  • Loading branch information
groverlynn committed Jul 16, 2023
1 parent a43c4cc commit 83d670c
Show file tree
Hide file tree
Showing 4 changed files with 121 additions and 43 deletions.
24 changes: 12 additions & 12 deletions data/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -212,36 +212,36 @@ foreach(DICT ${DICTS})
endforeach(DICT)

set(CONFIG_FILES
config/hk2s.json
config/hk2t.json
config/jp2t.json
config/s2hk.json
config/s2t.json
config/s2tw.json
config/t2hk.json
config/t2jp.json
config/t2s.json
config/t2tw.json
config/tw2s.json
config/tw2t.json
config/hk2cnp.json
config/hk2myp.json
config/hk2s.json
config/hk2sgp.json
config/hk2t.json
config/jp2t.json
config/s2cnp.json
config/s2hk.json
config/s2hkp.json
config/s2mop.json
config/s2myp.json
config/s2sgp.json
config/s2t.json
config/s2tw.json
config/s2twp.json
config/t2cnp.json
config/t2hk.json
config/t2hkp.json
config/t2jp.json
config/t2mop.json
config/t2myp.json
config/t2s.json
config/t2sgp.json
config/t2tw.json
config/t2twp.json
config/tw2cnp.json
config/tw2myp.json
config/tw2s.json
config/tw2sgp.json
config/tw2t.json
)

install(
Expand Down
18 changes: 17 additions & 1 deletion node/configs.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,35 @@
"copies": [{
"destination": "<(PRODUCT_DIR)",
"files": [
"../data/config/hk2cnp.json",
"../data/config/hk2myp.json",
"../data/config/hk2s.json",
"../data/config/hk2sgp.json",
"../data/config/hk2t.json",
"../data/config/jp2t.json",
"../data/config/s2cnp.json",
"../data/config/s2hk.json",
"../data/config/s2hkp.json",
"../data/config/s2mop.json",
"../data/config/s2myp.json",
"../data/config/s2sgp.json",
"../data/config/s2t.json",
"../data/config/s2tw.json",
"../data/config/s2twp.json",
"../data/config/t2cnp.json",
"../data/config/t2hk.json",
"../data/config/t2hkp.json",
"../data/config/t2jp.json",
"../data/config/t2mop.json",
"../data/config/t2myp.json",
"../data/config/t2s.json",
"../data/config/t2sgp.json",
"../data/config/t2tw.json",
"../data/config/t2twp.json",
"../data/config/tw2cnp.json",
"../data/config/tw2myp.json",
"../data/config/tw2s.json",
"../data/config/tw2sp.json",
"../data/config/tw2sgp.json",
"../data/config/tw2t.json",
]
}]
Expand Down
107 changes: 78 additions & 29 deletions node/dicts.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -42,73 +42,122 @@
"outputs": ["<(output_prefix)TSPhrases.ocd2"],
"action": ["node", "<(cmd)", "<(input)", "<@(_outputs)"]
}, {
"action_name": "TWVariants",
"action_name": "CNVocabulary.txt",
"inputs": ["<(cmd)"],
"outputs": ["<(output_prefix)CNVocabulary.txt"],
"action": ["python", "<(dict_merge)", "<(input_prefix)CNVocabToponym.txt", "<(input_prefix)CNVocabSciTech.txt", "<(input_prefix)CNVocabOthers.txt", "<@(_outputs)"]
}, {
"action_name": "CNVocabulary",
"variables": {
"input": "<(input_prefix)TWVariants.txt",
"input": "<(output_prefix)CNVocabulary.txt",
},
"inputs": ["<(input)"],
"outputs": ["<(output_prefix)TWVariants.ocd2"],
"outputs": ["<(output_prefix)CNVocabulary.ocd2"],
"action": ["node", "<(cmd)", "<(input)", "<@(_outputs)"]
}, {
"action_name": "TWVariantsRevPhrases",
"action_name": "HKVocabulary.txt",
"inputs": ["<(cmd)"],
"outputs": ["<(output_prefix)HKVocabulary.txt"],
"action": ["python", "<(dict_merge)", "<(input_prefix)HKVocabToponym.txt", "<(input_prefix)HKVocabSciTech.txt", "<(input_prefix)HKVocabOthers.txt", "<@(_outputs)"]
}, {
"action_name": "HKVocabulary",
"variables": {
"input": "<(input_prefix)TWVariantsRevPhrases.txt",
"input": "<(output_prefix)HKVocabulary.txt",
},
"inputs": ["<(input)"],
"outputs": ["<(output_prefix)TWVariantsRevPhrases.ocd2"],
"outputs": ["<(output_prefix)HKVocabulary.ocd2"],
"action": ["node", "<(cmd)", "<(input)", "<@(_outputs)"]
}, {
"action_name": "JPVariants",
"action_name": "MOVocabulary.txt",
"inputs": ["<(cmd)"],
"outputs": ["<(output_prefix)MOVocabulary.txt"],
"action": ["python", "<(dict_merge)", "<(input_prefix)MOVocabToponym.txt", "<(input_prefix)MOVocabSciTech.txt", "<(input_prefix)MOVocabOthers.txt", "<@(_outputs)"]
}, {
"action_name": "MOVocabulary",
"variables": {
"input": "<(input_prefix)JPVariants.txt",
"input": "<(output_prefix)MOVocabulary.txt",
},
"inputs": ["<(input)"],
"outputs": ["<(output_prefix)JPVariants.ocd2"],
"outputs": ["<(output_prefix)MOVocabulary.ocd2"],
"action": ["node", "<(cmd)", "<(input)", "<@(_outputs)"]
}, {
"action_name": "TWPhrases.txt",
"action_name": "MYVocabulary.txt",
"inputs": ["<(cmd)"],
"outputs": ["<(output_prefix)TWPhrases.txt"],
"action": ["python", "<(dict_merge)", "<(input_prefix)TWPhrasesIT.txt", "<(input_prefix)TWPhrasesName.txt", "<(input_prefix)TWPhrasesOther.txt", "<@(_outputs)"]
"outputs": ["<(output_prefix)MYVocabulary.txt"],
"action": ["python", "<(dict_merge)", "<(input_prefix)MYVocabToponym.txt", "<(input_prefix)MYVocabSciTech.txt", "<(input_prefix)MYVocabOthers.txt", "<@(_outputs)"]
}, {
"action_name": "TWVariantsRev.txt",
"action_name": "MYVocabulary",
"variables": {
"input": "<(input_prefix)TWVariants.txt",
"input": "<(output_prefix)MYVocabulary.txt",
},
"inputs": ["<(input)"],
"outputs": ["<(output_prefix)TWVariantsRev.txt"],
"action": ["python", "<(dict_reverse)", "<(input)", "<@(_outputs)"]
"outputs": ["<(output_prefix)MYVocabulary.ocd2"],
"action": ["node", "<(cmd)", "<(input)", "<@(_outputs)"]
}, {
"action_name": "SGVocabulary.txt",
"inputs": ["<(cmd)"],
"outputs": ["<(output_prefix)SGVocabulary.txt"],
"action": ["python", "<(dict_merge)", "<(input_prefix)SGVocabToponym.txt", "<(input_prefix)SGVocabSciTech.txt", "<(input_prefix)SGVocabOthers.txt", "<@(_outputs)"]
}, {
"action_name": "TWPhrasesRev.txt",
"action_name": "SGVocabulary",
"variables": {
"input": "<(output_prefix)TWPhrases.txt",
"input": "<(output_prefix)SGVocabulary.txt",
},
"inputs": ["<(input)"],
"outputs": ["<(output_prefix)TWPhrasesRev.txt"],
"action": ["python", "<(dict_reverse)", "<(input)", "<@(_outputs)"]
"outputs": ["<(output_prefix)SGVocabulary.ocd2"],
"action": ["node", "<(cmd)", "<(input)", "<@(_outputs)"]
}, {
"action_name": "TWVocabulary.txt",
"inputs": ["<(cmd)"],
"outputs": ["<(output_prefix)TWVocabulary.txt"],
"action": ["python", "<(dict_merge)", "<(input_prefix)TWVocabToponym.txt", "<(input_prefix)TWVocabSciTech.txt", "<(input_prefix)TWVocabOthers.txt", "<@(_outputs)"]
}, {
"action_name": "TWPhrases",
"action_name": "TWVocabulary",
"variables": {
"input": "<(output_prefix)TWPhrases.txt",
"input": "<(output_prefix)TWVocabulary.txt",
},
"inputs": ["<(input)"],
"outputs": ["<(output_prefix)TWPhrases.ocd2"],
"outputs": ["<(output_prefix)TWVocabulary.ocd2"],
"action": ["node", "<(cmd)", "<(input)", "<@(_outputs)"]
}, {
"action_name": "TWVariantsRev",
"action_name": "TWVariants",
"variables": {
"input": "<(output_prefix)TWVariantsRev.txt",
"input": "<(input_prefix)TWVariants.txt",
},
"inputs": ["<(input)"],
"outputs": ["<(output_prefix)TWVariantsRev.ocd2"],
"outputs": ["<(output_prefix)TWVariants.ocd2"],
"action": ["node", "<(cmd)", "<(input)", "<@(_outputs)"]
}, {
"action_name": "TWPhrasesRev",
"action_name": "TWVariantsRevPhrases",
"variables": {
"input": "<(output_prefix)TWPhrasesRev.txt",
"input": "<(input_prefix)TWVariantsRevPhrases.txt",
},
"inputs": ["<(input)"],
"outputs": ["<(output_prefix)TWPhrasesRev.ocd2"],
"outputs": ["<(output_prefix)TWVariantsRevPhrases.ocd2"],
"action": ["node", "<(cmd)", "<(input)", "<@(_outputs)"]
}, {
"action_name": "JPVariants",
"variables": {
"input": "<(input_prefix)JPVariants.txt",
},
"inputs": ["<(input)"],
"outputs": ["<(output_prefix)JPVariants.ocd2"],
"action": ["node", "<(cmd)", "<(input)", "<@(_outputs)"]
}, {
"action_name": "TWVariantsRev.txt",
"variables": {
"input": "<(input_prefix)TWVariants.txt",
},
"inputs": ["<(input)"],
"outputs": ["<(output_prefix)TWVariantsRev.txt"],
"action": ["python", "<(dict_reverse)", "<(input)", "<@(_outputs)"]
}, {
"action_name": "TWVariantsRev",
"variables": {
"input": "<(output_prefix)TWVariantsRev.txt",
},
"inputs": ["<(input)"],
"outputs": ["<(output_prefix)TWVariantsRev.ocd2"],
"action": ["node", "<(cmd)", "<(input)", "<@(_outputs)"]
}, {
"action_name": "HKVariants",
Expand Down
15 changes: 14 additions & 1 deletion node/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,31 @@ const util = require('util');
const OpenCC = require('./opencc');

const configs = [
'hk2myp',
'hk2s',
'hk2sgp',
'hk2t',
'jp2t',
's2cnp',
's2hk',
's2hkp',
's2mop',
's2myp',
's2sgp',
's2t',
's2tw',
's2twp',
't2hk',
't2hkp',
't2jp',
't2mop',
't2myp',
't2s',
't2sgp',
'tw2cnp',
'tw2myp',
'tw2s',
'tw2sp',
'tw2sgp',
'tw2t',
];

Expand Down

0 comments on commit 83d670c

Please sign in to comment.