Skip to content

Commit 9270fab

Browse files
committed
COMBO-NLP
1 parent 4669127 commit 9270fab

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

doc/pl.ipynb

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,9 +178,19 @@
178178
"cell_type":"code",
179179
"metadata":{ "colab_type":"code" },
180180
"source":[
181-
"!pip install deplacy combo-nlp\n",
182-
"from combo.predict import COMBO\n",
183-
"nlp=COMBO.from_pretrained(\"polish-herbert-base-ud213\")\n",
181+
"!apt install python3.9 python3.9-dev python3.9-distutils\n",
182+
"import sys\n",
183+
"v=\".\".join(sys.version.split(\".\")[0:2])\n",
184+
"!update-alternatives --remove-all python3\n",
185+
"!update-alternatives --install /usr/bin/python3 python3 /usr/bin/python{v} 1\n",
186+
"!update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 2\n",
187+
"!apt install python3-pip\n",
188+
"!pip install \"setuptools<57\" \"jax<0.5\" deplacy\n",
189+
"!pip install combo-nlp\n",
190+
"!echo 1 | update-alternatives --config python3\n",
191+
"!pip install deplacy\n",
192+
"import subprocess\n",
193+
"nlp=lambda t:subprocess.run([\"python3.9\",\"-c\",\"\\n\".join([\"from combo.predict import COMBO\",\"import deplacy\",\"n=COMBO.from_pretrained('polish-herbert-base-ud213')\",\"print(deplacy.to_conllu(n(input())),end='')\"])],input=t,stdout=subprocess.PIPE,encoding=\"utf-8\").stdout\n",
184194
"doc=nlp(\"Wcale nie chcemy zdobywać kosmosu, chcemy tylko rozszerzyć Ziemię do jego granic.\")\n",
185195
"import deplacy\n",
186196
"deplacy.render(doc)\n",

0 commit comments

Comments
 (0)