Taizo Kaneko
commited on
Commit
·
bf2baa3
1
Parent(s):
2b28047
Update README.md
Browse files
README.md
CHANGED
|
@@ -32,7 +32,7 @@ Google Colaboratory Example
|
|
| 32 |
```
|
| 33 |
! apt install aptitude swig > /dev/null
|
| 34 |
! aptitude install mecab libmecab-dev mecab-ipadic-utf8 git make curl xz-utils file -y > /dev/null
|
| 35 |
-
! pip install transformers torch mecab-python3
|
| 36 |
! ln -s /etc/mecabrc /usr/local/etc/mecabrc
|
| 37 |
```
|
| 38 |
|
|
@@ -41,7 +41,13 @@ from transformers import pipeline
|
|
| 41 |
import pandas as pd
|
| 42 |
import numpy as np
|
| 43 |
|
| 44 |
-
pipeline = pipeline("feature-extraction", model="paulhindemith/fasttext-jp-embedding", revision="2022.11.6", trust_remote_code=True)
|
| 45 |
text = "海賊王におれはなる"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
pd.DataFrame(np.array(pipeline(text)).T, columns=pipeline.tokenizer.tokenize(text))
|
| 47 |
```
|
|
|
|
| 32 |
```
|
| 33 |
! apt install aptitude swig > /dev/null
|
| 34 |
! aptitude install mecab libmecab-dev mecab-ipadic-utf8 git make curl xz-utils file -y > /dev/null
|
| 35 |
+
! pip install transformers torch mecab-python3 torchtyping > /dev/null
|
| 36 |
! ln -s /etc/mecabrc /usr/local/etc/mecabrc
|
| 37 |
```
|
| 38 |
|
|
|
|
| 41 |
import pandas as pd
|
| 42 |
import numpy as np
|
| 43 |
|
|
|
|
| 44 |
text = "海賊王におれはなる"
|
| 45 |
+
|
| 46 |
+
pipeline = pipeline("feature-extraction", model="paulhindemith/fasttext-jp-embedding", revision="2022.11.6", trust_remote_code=True)
|
| 47 |
+
pd.DataFrame(np.array(pipeline(text)).T, columns=pipeline.tokenizer.tokenize(text))
|
| 48 |
+
```
|
| 49 |
+
|
| 50 |
+
```
|
| 51 |
+
pipeline.tokenizer.target_hinshi = ["動詞", "名詞", "形容詞"]
|
| 52 |
pd.DataFrame(np.array(pipeline(text)).T, columns=pipeline.tokenizer.tokenize(text))
|
| 53 |
```
|