aboutsummaryrefslogtreecommitdiff
path: root/search
diff options
context:
space:
mode:
Diffstat (limited to 'search')
-rw-r--r--search/tags.ts30
1 files changed, 15 insertions, 15 deletions
diff --git a/search/tags.ts b/search/tags.ts
index 22ea315..32ce02f 100644
--- a/search/tags.ts
+++ b/search/tags.ts
@@ -148,19 +148,19 @@ export const Tag = {
/** @constant 〜とする attempts (e.g. 入ろうとしている) */
ToSuru: "infl:attempt:tosuru",
},
- /** @constant temporary tags (removed by parseTags) */
- Temporary: {
- /** @constant particle of obligatory conjugation (e.g. 行かない*と*だめ), or colloquial abbreviation */
- ObligatoryParticle: "infl:tmp:must:prt",
- /** @constant resulting action part of obligatory conjugation (e.g. 行かないと*だめ*) */
- ObligatoryResult: "infl:tmp:must:res",
- },
},
/** @constant uncategorized tags */
Auxiliary: {
/** @constant word usually written using only kana (but also has kanji) */
UsuallyKana: "aux:uk",
},
+ /** @constant temporary tags (removed by parseTags) */
+ Temporary: {
+ /** @constant particle of obligatory conjugation (e.g. 行かない*と*だめ), or colloquial abbreviation */
+ ObligatoryParticle: "tmp:infl:must:prt",
+ /** @constant resulting action part of obligatory conjugation (e.g. 行かないと*だめ*) */
+ ObligatoryResult: "tmp:infl:must:res",
+ },
} as const;
export const TagGroup = {
@@ -198,7 +198,7 @@ export function parseTags(input: string) {
if (tag == Tag.Inflection.Suffix.Te && [
Tag.Inflection.Tense.Continuous, // base for continuous tense
Tag.Inflection.Obligatory, // base for obligatory inflection
- Tag.Inflection.Temporary.ObligatoryParticle, // base for obligatory inflection
+ Tag.Temporary.ObligatoryParticle, // base for obligatory inflection
Tag.Inflection.Attempt.Miru, // base for 〜みる attempt
].includes(lastTag as any)) continue;
@@ -210,8 +210,8 @@ export function parseTags(input: string) {
// skip conditional 〜ば if used for obligatory inflection
if (tag == Tag.Inflection.Conditional.Ba && [
Tag.Inflection.Obligatory,
- Tag.Inflection.Temporary.ObligatoryResult,
- Tag.Inflection.Temporary.ObligatoryParticle,
+ Tag.Temporary.ObligatoryResult,
+ Tag.Temporary.ObligatoryParticle,
].includes(lastTag as any)) continue;
// normalize multiple Inflection.Negative to single Inflection.Affirmative or Inflection.Negative
@@ -220,12 +220,12 @@ export function parseTags(input: string) {
continue;
}
- filteredTags.push(tag);
+ filteredTags.unshift(tag);
}
// negative + と without resulting action = implicit affirmative obligatory
- if (filteredTags.includes(Tag.Inflection.Temporary.ObligatoryParticle) &&
- !filteredTags.includes(Tag.Inflection.Temporary.ObligatoryResult)) {
+ if (filteredTags.includes(Tag.Temporary.ObligatoryParticle) &&
+ !filteredTags.includes(Tag.Temporary.ObligatoryResult)) {
negationCount = 0; // -> make resulting tags affirmative
}
@@ -233,8 +233,8 @@ export function parseTags(input: string) {
filteredTags.push(negationCount % 2 == 0 ? Tag.Inflection.Affirmative : Tag.Inflection.Negative);
// filter any remaining temporary tags
- type tempTag = typeof Tag.Inflection.Temporary[keyof typeof Tag.Inflection.Temporary];
- filteredTags = filteredTags.filter(t => !Object.values(Tag.Inflection.Temporary).includes(t as tempTag));
+ type tempTag = typeof Tag.Temporary[keyof typeof Tag.Temporary];
+ filteredTags = filteredTags.filter(t => !Object.values(Tag.Temporary).includes(t as tempTag));
// filter any duplicates
return filteredTags.set().arr() as TokenTags;