I tried natural language processing with transformers.

I played with transformers, a natural language library. https://huggingface.co/transformers/main_classes/pipelines.html https://github.com/huggingface/transformers

When I entered "I am happy", it was output as positive.

$pip install -q transformers

str = "I am happy"
nlp_sentence_classif(str)

[{'label': 'POSITIVE', 'score': 0.9998802}]

You can also answer questions. When I ask "What do you like?" To the sentence "I am a student who likes computer science.", "Computer science" is returned.

nlp = pipeline('question-answering')
nlp({
    'question': 'What do you like?',
    'context': 'I am a student who likes computer science.'
})

{'answer': 'computer science.',
 'end': 41,
 'score': 0.978939160814079,
 'start': 25}

Sounds good.

I couldn't find out what model this library uses by default. (~ _ ~ Me)

Recommended Posts

I tried natural language processing with transformers.
[Python] I played with natural language processing ~ transformers ~
I tried 100 language processing knock 2020
Study natural language processing with Kikagaku
[Natural language processing] Preprocessing with Japanese
I tried 100 language processing knock 2020: Chapter 3
I tried 100 language processing knock 2020: Chapter 1
I tried 100 language processing knock 2020: Chapter 2
I tried 100 language processing knock 2020: Chapter 4
I tried to extract named entities with the natural language processing library GiNZA
I tried to classify Mr. Habu and Mr. Habu with natural language processing × naive Bayes classifier
3. Natural language processing with Python 2-1. Co-occurrence network
3. Natural language processing with Python 1-1. Word N-gram
I tried natural number expression and arithmetic processing only with list processing
RNN_LSTM2 Natural language processing
Sentiment analysis with natural language processing! I tried to predict the evaluation from the review text
3. Natural language processing with Python 2-2. Co-occurrence network [mecab-ipadic-NEologd]
I tried Python-like loop processing with BigQuery Scripting
Let's enjoy natural language processing with COTOHA API
I tried simple image processing with Google Colaboratory.
I tried fp-growth with python
100 Language Processing with Python Knock 2015
I tried scraping with Python
I read an introductory book on natural language processing
I tried Learning-to-Rank with Elasticsearch!
[Python] [Natural language processing] I tried Deep Learning ❷ made from scratch in Japanese ①
I tried clustering with PyCaret
3. Natural language processing with Python 4-1. Analysis for words with KWIC
Natural language processing 1 Morphological analysis
Natural language processing 3 Word continuity
I tried gRPC with Python
I tried scraping with python
Natural language processing 2 Word similarity
3. Natural language processing with Python 5-1. Concept of sentiment analysis [AFINN-111]
I tried to divide with a deep learning language model
3. Natural language processing with Python 5-2. Emotion intensity analysis tool VADER
100 natural language processing knocks Chapter 4 Commentary
I tried trimming efficiently with OpenCV
I tried summarizing sentences with summpy
Natural language processing for busy people
I tried machine learning with liblinear
I tried web scraping with python.
I tried moving food with SinGAN
100 Language Processing Knock with Python (Chapter 3)
Artificial language Lojban and natural language processing (artificial language processing)
I tried implementing DeepPose with PyTorch
I tried face detection with MTCNN
Python beginner tried 100 language processing knock 2015 (05 ~ 09)
I tried running prolog with python 3.8.2.
Preparing to start natural language processing
Natural language processing analyzer installation summary
I tried SMTP communication with Python
I tried sentence generation with GPT-2
I tried learning LightGBM with Yellowbrick
I tried face recognition with OpenCV
I tried asynchronous processing using asyncio
Python beginner tried 100 language processing knock 2015 (00 ~ 04)
[Natural language processing] I tried to visualize the hot topics this week in the Slack community
[Natural language processing] I tried to visualize the remarks of each member in the Slack community
I tried to solve 100 language processing knock 2020 version [Chapter 2: UNIX commands 10 to 14]
Easily build a natural language processing model with BERT + LightGBM + optuna