diff options
author | lonkaars <loek@pipeframe.xyz> | 2023-06-29 11:33:23 +0200 |
---|---|---|
committer | lonkaars <loek@pipeframe.xyz> | 2023-06-29 11:33:23 +0200 |
commit | c998e1c0477d51c886f9e4246e102dec4d7ef8dd (patch) | |
tree | 4d979c57f16b138ff4b2ce5fb3151ce241af6881 /util/string.ts | |
parent | 67dbb6421976254658c5e38045513129dd18187a (diff) |
add jmdict importer to repo
Diffstat (limited to 'util/string.ts')
-rw-r--r-- | util/string.ts | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/util/string.ts b/util/string.ts index d94f5a3..e0cc5eb 100644 --- a/util/string.ts +++ b/util/string.ts @@ -1,4 +1,4 @@ -import { TokenTags, TokenTag, Tag } from "../language/tags.ts"; +import { TokenTags, parseTags } from "../language/tags.ts"; import JapaneseString from "../language/japanese.ts"; declare global { @@ -60,15 +60,6 @@ String.prototype.jp = function() { /** @summary parse concatenated tag string to TokenTags */ String.prototype.parseTags = function() { - var tags = this.replaceAll(/ +/g, " ").trim().split(" ") as TokenTag[]; - var filteredTags: TokenTag[] = []; - for (var tag of tags) { - // skip past tense tags after -te and -tari deinflection - if (tag == Tag.Inflection.Tense.Past && - filteredTags.anyOf([Tag.Inflection.Suffix.Te, Tag.Inflection.Suffix.Tari])) continue; - - filteredTags.push(tag); - } - return new Set(filteredTags) as TokenTags; + return parseTags(this as string); } |