mirror of
https://github.com/mii443/akaza.git
synced 2025-12-03 02:58:21 +00:00
候補を保存しておく
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -1,4 +1,5 @@
|
||||
/comb/config.py
|
||||
__pycache__
|
||||
/comb.xml
|
||||
/hello.*
|
||||
/hello.*
|
||||
/test_graph2.py
|
||||
26
TODO.md
26
TODO.md
@@ -1,10 +1,28 @@
|
||||
- 共起的なスコアをいれたい
|
||||
- support 3gram
|
||||
- make dictionary more bigger.
|
||||
- 絵文字辞書(`beer` で絵文字いれたい。)
|
||||
# TODO
|
||||
|
||||
## Priority high
|
||||
|
||||
- 前向きDP後ろ向きA* で候補を得る
|
||||
- 単語 2 gram を学習データとして記録できるようにする
|
||||
- 連文節変換用の UI を実装する
|
||||
|
||||
## Priority mid
|
||||
|
||||
- 共起的なスコアをいれたい?
|
||||
- support 3gram(必要?)
|
||||
- 青空文庫をコーパスとして使う?
|
||||
- 絵文字辞書(`ビール` か `beer` で絵文字いれたい。)
|
||||
|
||||
- 変な変換
|
||||
- "げすとだけ" が "げストだけ" になる。
|
||||
- "bきゅう" が "B級" にならない
|
||||
|
||||
## Priority low
|
||||
|
||||
- 設定画面の実装
|
||||
- 単語登録機能
|
||||
|
||||
# DONE
|
||||
|
||||
- 「きょう」を %Y-%m-%d 等に変換できるようにしたい。
|
||||
- カタカナ語辞書の作成
|
||||
|
||||
@@ -17,6 +17,11 @@ import marisa_trie
|
||||
from datetime import date
|
||||
|
||||
|
||||
class Candidate:
|
||||
def __init__(self, word: str):
|
||||
self.word = word
|
||||
|
||||
|
||||
class Comb:
|
||||
logger: Logger
|
||||
dictionaries: List[Any]
|
||||
|
||||
@@ -24,7 +24,7 @@ class Node:
|
||||
|
||||
def __repr__(self):
|
||||
return f"<Node: start_pos={self.start_pos}, word={self.word}," \
|
||||
f" cost={self.cost}, prev={self.prev.word if self.prev else '-'}>"
|
||||
f" cost={self.cost}, prev={self.prev.word if self.prev else '-'} yomi={self.yomi}>"
|
||||
|
||||
def calc_node_cost(self) -> float:
|
||||
if self.is_bos():
|
||||
@@ -176,6 +176,9 @@ def viterbi(graph: Graph):
|
||||
result.append(node)
|
||||
if node == node.prev:
|
||||
raise AssertionError(f"node==node.prev: {node}")
|
||||
if not node.is_eos():
|
||||
# 他の候補を追加する。
|
||||
node.others = [n for n in graph[node.start_pos + len(node.yomi)] if node.yomi == n.yomi]
|
||||
node = node.prev
|
||||
return list(reversed(result))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user