|
--- |
|
language: |
|
- ja |
|
license: mit |
|
library_name: transformers |
|
tags: |
|
- fastText |
|
pipeline_tag: zero-shot-classification |
|
widget: |
|
- text: "海賊王におれはなる" |
|
candidate_labels: "海、山、陸" |
|
multi_class: true |
|
example_title: "ワンピース" |
|
--- |
|
# fasttext-classification |
|
fastText word vector base classifiction |
|
## Reference |
|
- fastText </br> |
|
https://github.com/facebookresearch/fastText |
|
- word vector data </br> |
|
https://dl.fbaipublicfiles.com/fasttext/vectors-crawl/cc.ja.300.vec.gz |
|
## Usage |
|
Google Colaboratory Example |
|
``` |
|
! apt install aptitude swig > /dev/null |
|
! aptitude install mecab libmecab-dev mecab-ipadic-utf8 git make curl xz-utils file -y > /dev/null |
|
! pip install transformers torch mecab-python3 torchtyping > /dev/null |
|
! ln -s /etc/mecabrc /usr/local/etc/mecabrc |
|
``` |
|
``` |
|
from transformers import pipeline |
|
p = pipeline("zero-shot-classification", "paulhindemith/fasttext-classification", revision="2022.11.7", trust_remote_code=True) |
|
``` |
|
``` |
|
p("海賊王におれはなる", candidate_labels=["海", "山", "陸"], hypothesis_template="{}", multi_label=True) |
|
``` |