-
Notifications
You must be signed in to change notification settings - Fork 3
fix(dict2): fixで"[助詞]"を省略するのは「が」のみに限定する #17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
src/dictionary.js
Outdated
return "は"; | ||
return ""; | ||
} | ||
return ""; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
これ結果的にすべて ""
を返すことになるのですが、どうするのが意図した感じですかね?
他に来るパターンの助詞があるのかな。
や
は一応これなのかな。(このtokenだとマッチしないけど)
必要なら解析することや聞くことができます
actualToken.surface_form
を返すのが意図した感じですかね?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
当初の意図
これは,単純にその助詞を削除して,元々意図していた意味を変えてしまうのを防ぐのを意図しました.
a: 期間は延長することができます
b: 期間は短縮できます.延長することもできます
c 期間は短縮できません.延長することはできます
a,b,cの助詞を単純に削除すると
期間は延長できます
となってしまいますが,そうすると元々の意図していた意味が変わってしまいます.
そこで,「も」「は」の場合は存置して
b': 延長もできます
c': 延長はできます
となるようにしたわけです.
他の副助詞も同様ですね.
延長することくらいできます
(なお,「や」は「できます」の 前 には来ないと思います)
問題
しかし,前文脈によっては不自然なケースがありますね.
オブジェクトを作成することもできます -> オブジェクトを作成もできます
は少々変で,「オブジェクトの作成もできます」にしたほうが自然ですね.
「が」の場合は自動fixできるようにして,それ以外の助詞の場合は自動fixしない,というのがベターではないかと思いました.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_capture_to_message
でメッセージには助詞を含める- 自動修正は 助詞が
が
に限定する
という感じにしてみます。
return ""; | ||
} | ||
return ""; | ||
return ExpectedType.STOP_REPLACE; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
STOP_REPLACEという特殊なパターンを入れた。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
とメッセージが出ているのに対して
--fix
では [助詞] が修正されてないのを修正してみました。asciidwango/js-primer#614 で--fixしてみた結果-> #17 (comment) 誤修正を防ぐために、「が」のみを自動修正するように変更した。