Skip to content

Commit

Permalink
Update: ユーザー辞書機能で対応する品詞の種類を拡充
Browse files Browse the repository at this point in the history
「固有名詞」より深い解像度で辞書登録できるようになり、辞書の効き目や精度が向上する(はず)
  • Loading branch information
tsukumijima committed Jan 6, 2025
1 parent 4afed1f commit 17725c5
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 4 deletions.
2 changes: 1 addition & 1 deletion openapi.json

Large diffs are not rendered by default.

28 changes: 26 additions & 2 deletions src/components/Dialog/DictionaryManageDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,11 @@ const computeDisplayAccent = () => {
const wordType = ref<WordTypes>(defaultWordType);
const wordTypeLabels = {
[WordTypes.ProperNoun]: "固有名詞",
[WordTypes.LocationName]: "地名",
[WordTypes.OrganizationName]: "組織・施設名",
[WordTypes.PersonName]: "人名",
[WordTypes.PersonFamilyName]: "人名 - 姓",
[WordTypes.PersonGivenName]: "人名 - 名",
[WordTypes.CommonNoun]: "一般名詞",
[WordTypes.Verb]: "動詞",
[WordTypes.Adjective]: "形容詞",
Expand All @@ -538,9 +543,28 @@ const wordTypeLabels = {
// 品詞フィールドから WordTypes を推定する関数
const getWordTypeFromPartOfSpeech = (dictData: UserDictWord): WordTypes => {
const { partOfSpeech, partOfSpeechDetail1 } = dictData;
const { partOfSpeech, partOfSpeechDetail1, partOfSpeechDetail2, partOfSpeechDetail3 } = dictData;
if (partOfSpeech === "名詞") {
if (partOfSpeechDetail1 === "固有名詞") return WordTypes.ProperNoun;
if (partOfSpeechDetail1 === "固有名詞") {
if (partOfSpeechDetail2 === "地域" && partOfSpeechDetail3 === "一般") {
return WordTypes.LocationName;
}
if (partOfSpeechDetail2 === "組織") {
return WordTypes.OrganizationName;
}
if (partOfSpeechDetail2 === "人名") {
if (partOfSpeechDetail3 === "一般") {
return WordTypes.PersonName;
}
if (partOfSpeechDetail3 === "") {
return WordTypes.PersonFamilyName;
}
if (partOfSpeechDetail3 === "") {
return WordTypes.PersonGivenName;
}
}
return WordTypes.ProperNoun;
}
if (partOfSpeechDetail1 === "接尾") return WordTypes.Suffix;
return WordTypes.CommonNoun;
}
Expand Down
2 changes: 1 addition & 1 deletion src/openapi/apis/DefaultApi.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/openapi/models/WordTypes.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 17725c5

Please sign in to comment.