In this article, I will present the process of reading a document. for the analysis of the natural language structure of the tree These processes are useful for those working in the analysis of natural language structure from documents. This may lead to applications with applications to process language structures to prepare data. (Pre-Processing) in the process of doing Data Science, which is very important. if we can't handle the initial modeling process effectively It may be a model that has no quality.
which the algorithm to process There are steps as follows.
- Import libraries spaCy, NLTK for natural language. processing, I will import pos_tag (Part-of-Speech Processing), word_tokenize (reading words from the Token), and Tree (drawing a tree structure).
- Import a natural language processing model from the spaCy library using “en_core_web_sm”, a smaller language processing model. Suitable for general language processing.
- read text from the text file.
- Methods to draw tree structures It uses the tree node reading method, which uses the Tree algorithm to draw it.
- Calling the Plot tree structure from an imported language readable from a file.
- Determining the pattern of words and drawing (result.draw()) by checking words from Token.
The result of drawing a tree from a language structure.
*Sentence 1: * “A small company manufactures customized bicycles.”
Drawing the sentence structure “A small company manufactures customized bicycles.” with NLTK.
Drawing the sentence structure “A small company manufactures customized bicycles.” with spaCy.
*Sentence 2: * “Whenever the sales department receives an order, a new process instance is created.”
Drawing a sentence structure “Whenever the sales department receives an order, a new process instance is created.” with NLTK.
Drawing a sentence structure “Whenever the sales department receives an order, a new process instance is created.” with spaCy.
Top comments (0)