Icon

Lab 7 & 8 Text Mining

Step 1: Reading Textual Data

  1. Use the Table Reader node to import data from:
    TripadvisorReviews-SanFranciscoRestaurants-ItalianChineseFood.table

  2. Filter (remove) rows with missing titles.

  3. Convert strings to documents with the Strings To Documents node.

  4. Filter (remove) all columns except the column containing the "Documents".

Step 2: Enrichment I

  1. Assign POS tag with the POS Tagger node.

  2. View tagged documents using the Tagged Document Viewer node.

Step 3: Pre-processing I

  1. Filter numbers, punctuation marks, stop words with the Number Filter, Punctuation Erasure and Stop Word Filter node, respectively.

  2. Convert texts to lower case using the Case Converter node.

  3. Perform stemming with the Snowball Stemmer node.

  4. Keep only tokens tagged as nouns, verbs, and adjectives using the Tag Filter node.

Step 3: Pre-processing II

  1. Create Bag of Words using the Bag Of Words Creator node.

  2. Use the Term To String node to extract terms as strings from a bag of words.

  3. Use the GroupBy node to group terms and count how many times they appear in pre-processed documents.

  4. Keep those terms that appear 5 or more times.

  5. Use the Reference Row Filter node to filter bag of words and keep only terms that occur in at least 5 documents.

Step 4: Transformation

  1. Compute relative term frequency with the TF node.

  2. Create document vectors using the Document Vector node.

  3. Extract class label/category for prediction with the Document Data Extractor node.

Step 5: Text Classification

  1. Append color information based on class labels using the Color Manager node.

  2. Filter out Document column.

  3. Split data into training (80%) and test (20%) set with stratified sampling on the target column using the Partitioning node.

  4. Train Decision Tree classifier on the training set with the Decision Tree Leaner node.

  5. Apply the trained model to the test set with the Decision Tree Predictor node.

  6. Score model with the Scorer node.

Lab 7 & 8 - Text Mining

Learning objective: In this exercise, you will practice performing classification using Machine Learning on your transformed text data.

Read TripadvisorReviews-SanFranciscoRestaurants-ItalianChineseFood data
Table Reader
Remove the missing values from review title column
Row Filter
Changing Term as String
Term to String
Create document
Strings to Document
Only keep Document column
Column Filter
Assign POS tag
POS Tagger
View identified tags
Tagged Document Viewer
GroupBy termcount documents
GroupBy
Keep terms that appear 5 or more times
Row Filter
Extract categoryfor prediction
Document Data Extractor
Filter Bag of WordsKeep only terms thatoccur in at least 5documents
Reference Row Filter
Compute relativeterm frequency
TF
Exclude the Document column
Column Filter
Split intotraining and testdata
Table Partitioner
Create document vector
Document Vector
Append color
Color Manager (deprecated)
Test set
Decision Tree Predictor
Score model
Scorer
Training set
Decision Tree Learner
Removing punctuation
Punctuation Erasure
Removing English stop words
Stop Word Filter
Choose "Filter Terms Representing Number"
Number Filter
Keep only adjectives, nouns and verbs
Tag Filter
Create Bag of Words
Bag Of Words Creator
Convert words tolower case
Case Converter
Changing the word to its common base
Snowball Stemmer

Nodes

Extensions

  • No modules found

Links