Skip to content

Conversation

azu
Copy link
Member

@azu azu commented Jan 4, 2019

"すること[助詞]できる"は冗長な表現です。"すること[助詞]"を省き簡潔な表現にすると文章が明瞭になります。

とメッセージが出ているのに対して --fix では [助詞] が修正されてないのを修正してみました。

asciidwango/js-primer#614 で--fixしてみた結果
-> #17 (comment) 誤修正を防ぐために、「が」のみを自動修正するように変更した。

@azu azu requested a review from shirayu January 4, 2019 14:08
return "";
return "";
}
return "";
Copy link
Member Author

@azu azu Jan 4, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

これ結果的にすべて "" を返すことになるのですが、どうするのが意図した感じですかね?
他に来るパターンの助詞があるのかな。
は一応これなのかな。(このtokenだとマッチしないけど)

必要なら解析することや聞くことができます

actualToken.surface_formを返すのが意図した感じですかね?

Copy link
Contributor

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しない,というのがベターではないかと思いました.

Copy link
Member Author

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;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

STOP_REPLACEという特殊なパターンを入れた。

@azu azu changed the title fix(dict2): fixで"[助詞]"が省略されない問題を修正 fix(dict2): fixで"[助詞]"が省略されない問題の「が」のみを対応 Jan 5, 2019
@azu azu changed the title fix(dict2): fixで"[助詞]"が省略されない問題の「が」のみを対応 fix(dict2): fixで"[助詞]"を省略するのは「が」のみに限定する Jan 5, 2019
Copy link
Contributor

@shirayu shirayu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@azu azu merged commit 9cd0538 into master Jan 6, 2019
@azu azu deleted the fix-dict2-jyoshi branch January 6, 2019 01:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants