DelphiPythonPython GUIWindows

Build A Python GUI Apps With Powerful Natural Language Processing Capabilities Using TextBlob Library In A Delphi Windows App

pexels panumas nikhomkhai 1148820

Do you want to perform Natural Language Processing tasks like part-of-speech tagging, noun phrase extraction, sentiment analysis, classification, translation, etc. in your GUI app? This post will get you to understand how to use TextBlob Python Library using Python4Delphi (P4D) in the Delphi/C++ Builder application and perform some interesting NLP tasks.

TextBlob is a Python library for processing textual data. It provides a simple and consistent API for diving into common natural language processing (NLP) tasks such as part-of-speech tagging, noun phrase extraction, sentiment analysis, classification, translation, and more.

TextBlob stands on the shoulders of Giants, like NLTK and pattern, and plays nicely with both.

TextBlob powerful features at  a glance:

  • Noun phrase extraction
  • Part-of-speech tagging (POS tagging)
  • Sentiment analysis
  • Classification (Naive Bayes, Decision Tree)
  • Tokenization (splitting text into words and sentences)
  • Word and phrase frequencies
  • Parsing
  • n-grams
  • Word inflection (pluralization and singularization) and lemmatization
  • Spelling correction
  • Add new models or languages through extensions
  • WordNet integration

 

Hands-On

This post will guide you on how to perform Natural Language Processing tasks via Python’s TextBlob  and then display it in the Delphi Windows GUI app.

First, open and run our Python GUI using project Demo1 from Python4Delphi with RAD Studio. Then insert the script into the lower Memo, click the Execute button, and get the result in the upper Memo. You can find the Demo1 source on GitHub. The behind the scene details of how Delphi manages to run your Python code in this amazing Python GUI can be found at this link.

0 rundemo1 6813476

The following code shows a demo for Part-of-Speech Tagging, Noun Phrase Extraction, and Sentiment Analysis capabilities using TextBlob (visit source here):

Here is the results in Python GUI:

1 7689386

The sentiment property returns a named tuple of the form Sentiment(polarity, subjectivity). The polarity score is a float value within the range [-1.0, 1.0] where -1.0 is very negative and 1.0 is very positive sentiment. The subjectivity is a float value t within the range [0.0, 1.0] where 0.0 is very objective and 1.0 is very subjective.

Let’s try TextBlob to perform the same operations as above to the excerpt of our articles:

It runs blazingly-fast, doing all the operations smoothly for even longer text. It also works perfectly even for neutral sentences.

2 5995008

 

Congratulations, now you have learned how to perform Natural Language Processing tasks via Python’s TextBlob  and then display it in the Delphi Windows GUI app

Check out the TextBlob library for Python and use it in your projects: https://pypi.org/project/textblob/ and

Check out Python4Delphi which easily allows you to build Python GUIs for Windows using Delphi: https://github.com/pyscripter/python4delphi

Related posts
CodeIDELearn PythonPythonPython GUITkinter

How To Make More Than 20 ChatGPT Prompts Work With Python GUI Builders And OpenCV Library?

CodeIDEProjectsPythonWindows

Unlock the Power of Python for Deep Learning with Radial Basis Function Networks (RBFNs)

CodeIDELearn PythonPythonPython GUITkinter

How To Make More Than 20 ChatGPT Prompts Work With Python GUI Builders And NumPy Library?

CodeIDEProjectsPythonWindows

Unlock the Power of Python for Deep Learning with Generative Adversarial Networks (GANs) - The Engine behind DALL-E

Leave a Reply

Your email address will not be published. Required fields are marked *