Skip to content
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

[Feature Request] 漢数字からアラビア数字への変換を無効にするオプションの追加 #21

Closed
yagays opened this issue Aug 7, 2021 · 3 comments
Labels
enhancement New feature or request

Comments

@yagays
Copy link
Owner

yagays commented Aug 7, 2021

🚀 機能提案

漢数字からアラビア数字への変換を無効にするオプションの追加

モチベーション

  • 漢数字からアラビア数字に変換する際に「一時はどうなることかと」「十分なインターバル」といった表現を誤検出してしまう問題がある
  • 日付が漢数字で書かれないドキュメントであることが分かっている場合には、こうした変換を無効にすることで抽出精度を上げることができる

解決策や課題解決の方針

以下のように引数を渡す。

timex_parser = TimexParser(ignroe_kansuji=True)

追加/補足情報

@yagays yagays added the enhancement New feature or request label Aug 7, 2021
@mephistobooks
Copy link

とても興味深いライブラリをありがとうございます。
漢数字のうち、熟語として確立している単語の中にあるものは除外する、という手段も欲しく思います(ホワイトリストを提供するなどの形になるでしょうか)。

@yagays
Copy link
Owner Author

yagays commented Aug 9, 2021

コメントありがとうございます。

現在でも一部の数字を含む熟語はルールで除外する仕様になっていますが、文脈を考慮しないと時間情報表現と熟語の区別ができないものも存在するため、そうしたケースは現在含めておりません。ユーザ指定のホワイトリストも現実的ではありますが、ただ指定されたものを除くだけだと下記のようにユーザ側でコントロールすればそれで十分な気もします。

timexes = timex_parser(intput)
results = [t for t in timexes if t.text not in ("十分", "一時")]

ユーザにとって、ホワイトリスト的な列挙が手軽なのか、抽出すべき時間情報表現のバリエーションが限られていて一括で指定するのが楽なのかは、検討したいと思います。

https://github.com/yagays/ja-timex/blob/master/ja_timex/number_normalizer.py#L63

@yagays
Copy link
Owner Author

yagays commented Aug 14, 2021

#44

@yagays yagays closed this as completed Aug 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants