Skip to content

Commit

Permalink
unsupport fastHan
Browse files Browse the repository at this point in the history
  • Loading branch information
KoichiYasuoka committed Mar 30, 2024
1 parent 04b31d6 commit 7c77cff
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 45 deletions.
23 changes: 0 additions & 23 deletions doc/zh-cn.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -198,29 +198,6 @@
"# import graphviz\n",
"# graphviz.Source(deplacy.dot(doc))"
]
},
{
"cell_type":"markdown",
"metadata":{ "colab_type":"text" },
"source":[
"## 用[fastHan](https://github.com/fastnlp/fastHan)\n"
]
},
{
"cell_type":"code",
"metadata":{ "colab_type":"code" },
"source":[
"!pip install deplacy fastHan\n",
"from fastHan import FastHan\n",
"model=FastHan()\n",
"nlp=lambda x:\"\".join(\"\\n\".join(\"\\t\".join([str(i+1),t[0],\"_\",t[3],t[3],\"_\",str(t[1]),t[2],\"_\",\"SpaceAfter=No\"]) for i,t in enumerate(s))+\"\\n\\n\" for s in model(x,\"Parsing\"))\n",
"doc=nlp(\"不管黑猫白猫,捉到老鼠就是好猫。\")\n",
"import deplacy\n",
"deplacy.render(doc)\n",
"deplacy.serve(doc,port=None)\n",
"# import graphviz\n",
"# graphviz.Source(deplacy.dot(doc))"
]
}
]
}
22 changes: 0 additions & 22 deletions doc/zh-cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,25 +164,3 @@
PUNCT <══════════╝ punct
```

## [fastHan](https://github.com/fastnlp/fastHan)

```
>>> from fastHan import FastHan
>>> model=FastHan()
>>> nlp=lambda x:"".join("\n".join("\t".join([str(i+1),t[0],"_",t[3],t[3],"_",str(t[1]),t[2],"_","SpaceAfter=No"]) for i,t in enumerate(s))+"\n\n" for s in model(x,"Parsing"))
>>> doc=nlp("不管黑猫白猫,捉到老鼠就是好猫。")
>>> import deplacy
>>> deplacy.render(doc)
不管 AD <══╗ advmod
黑猫 NN <╗ ║ nn
白猫 NN ═╝═╝<╗ nsubj
, PU <════║═══╗ punct
捉到 VV ═╗═══╝<╗ ║ dep
老鼠 NN <╝ ║ ║ dobj
就 AD <════╗ ║ ║ advmod
是 VC ═══╗═╝═╝═╝═╗ root
好 JJ <╗ ║ ║ amod
猫 NN ═╝<╝ ║ attr
。 PU <══════════╝ punct
```

0 comments on commit 7c77cff

Please sign in to comment.