-
Notifications
You must be signed in to change notification settings - Fork 3
複数の助詞にマッチするように #9
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
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.
ありがとうございます。
コメントしました
src/index.js
Outdated
const dictionaryList = require("./dictionary"); | ||
const createMatchAll = require("morpheme-match-all"); | ||
const replaceWithCaptureTokens = (text, tokens, actualTokens) => { | ||
const replaceWithCaptureTokens = (text, tokens, actualTokens, for_expected) => { |
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.
引数が増えてきたので引数をオブジェクトにした方がよさそうですね。
後、expectedとmessageを関数として分けたほうがいい気がしますね。
(内部で分岐が増えると読みにくくなると思うので)
- token -> matchTokens
const createExpected = ({ text, matcherTokens, actualTokens }) => {
}
const createMessage = ({ text, matcherTokens, actualTokens }) => {
}
// 共通なのはtoken単体に対する置換処理にできそうな気がする
const replaceTokenWith = (matcherToken, actualToken) => {
/* この辺だけのtoken単体に対する置換処理を切り出せる?
let to;
if (for_expected && token["_capture_to_expected"]) {
to = token["_capture_to_expected"](actualTokens[index]);
} else if (!for_expected && token["_capture_to_message"]) {
to = token["_capture_to_message"](actualTokens[index]);
} else {
to = actualTokens[index].surface_form;
}
}*/
}
createExpected({
text: matchResult.dict.expected,
matcherTokens: matchResult.dict.tokens,
actualTokens: matchResult.tokens
});
のようなイメージ
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.
なるほど,検討してみます!
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.
pushしました
src/index.js
Outdated
if (for_expected && token["_capture_to_expected"]) { | ||
to = token["_capture_to_expected"](actualTokens[index]); | ||
} else if (!for_expected && token["_capture_to_message"]) { | ||
to = token["_capture_to_message"](actualTokens[index]); |
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.
これ利用していますか? 辞書にはない気もします。
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.
これは
75eb8bb#diff-d460974cf13fda7ff6679698d7b13fd4R84
で使っています
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
の方はない気がします?
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
は記述を統一的にするために付けただけで,今回のPRでは使っていません
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
#7 の一部に対処しました.
の検出を
に拡充しました.
またREADMEも修正しました.
#6 と同様にtechnological-book-corpus-jaを使った比較結果も添付します.