Skip to content

Commit

Permalink
[BUGFIX] Fixes a bug when predict long sentences
Browse files Browse the repository at this point in the history
  • Loading branch information
Chen Wang committed Dec 9, 2020
1 parent e1e9a66 commit 461b544
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions chapter-3/分词.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -275,9 +275,14 @@
"hmm.train('./data/trainCorpus.txt_utf8')\n",
"\n",
"text = '这是一个非常棒的方案!'\n",
"res = hmm.cut(text)\n",
"res = []\n",
"for fragment in text.replace(\"\", \"\").replace(\"\", \"\").replace(\"\", \"\").split(\"\"):\n",
" if fragment == '':\n",
" continue\n",
" for segment in list(hmm.cut(fragment)):\n",
" res.append(segment)\n",
"print(text)\n",
"print(str(list(res)))"
"print(str(res))"
]
},
{
Expand Down

0 comments on commit 461b544

Please sign in to comment.