Programmieren lernen
PacmanÜber mich
English
English
  • Course Outline
  • 1 - Databricks
    • Getting Started
    • Working with Notebooks
      • Adding Documentation
      • Built-In Visualizations
      • Import Data
      • Export Data
  • 2 - Introduction
    • Types of Questions
      • Finding Individual Records
      • Summarizing Data
      • Exploring Data
      • Drawing Inferences From Data
      • Predicting Information
      • Finding Causality
    • Steps in Data Analytics
    • Dimensions of Data Sets
    • Dimensions of Records
    • Dimensions of Fields
    • Data Types and Scales
  • 3 - SQL
    • Basic SQL
      • What is SQL?
      • Import Data
      • Select Columns
      • Filter Rows
      • Aggregate and Group Rows
      • Filter Aggregated Rows
      • Sort Rows
    • Advanced SQL
      • Views
      • Set Operators
      • Subqueries
      • Window Functions
      • Date and Time
      • Arrays
      • JSON
      • Statistical Analysis
    • Multiple Data Sets with SQL
    • Text with SQL
      • Search Text
      • Analyzing Words
        • Prefilter the Data
        • Clean and Normalize
        • Tokenize and Count
        • Filter Stop Words
        • POS Tagging
      • Word Pairs
      • Extract Emoticons
  • 4 - Python
    • Python for Data Analytics
      • What is Python?
    • Natural Language Processing
  • 5 - R
    • R Basics
  • 6 - Visualization
    • Why Visualize Data?
    • Data Visualization with R
    • Types of Visualizations
      • Developments and Trends
      • Distributions
    • Pitfalls in Data Visualization
  • 7 - Tableau
    • Getting Data Into Tableau
  • 8 - Spreadsheets
    • What Is A Spreadsheet?
  • Data & Exercises
    • Simpsons
    • Covid19
    • TED Talks
    • Lemonade Market Research
    • Chicago Crimes
    • Tweets of German Politicians
    • Amazon Product Reviews
    • REWE Online Products
Powered by GitBook
On this page

Was this helpful?

  1. 3 - SQL
  2. Text with SQL
  3. Analyzing Words

POS Tagging

PreviousFilter Stop WordsNextWord Pairs

Last updated 4 years ago

Was this helpful?

Wörter mit weiteren Informationen anreichern

Mit den Daten aus können wir schon zuverlässig arbeiten. Es geht aber immer noch besser. Zum Beispiel könnten wir die Wörter mit weiteren Metainformationen anreichern, was uns wiederum bessere Analysemöglichkeiten eröffnet. Metadaten können sein:

  • Handelt es sich um ein Verb, Adjektiv oder Substantiv?

  • Wie lautet der Wortstamm?

  • Aus welcher Sprache stammt das Wort?

  • Ist das Wort positiv oder negativ behaftet?

Beim POS Tagging geht um den ersten Punkt. Wir wollen für jedes Wort die Information ergänzen, um welche Art von Wort es sich handelt. Ein naiver Ansatz ist es, ähnlich wie bei den Stopwörtern auf eine Liste aus dem Internet zurückzugreifen. Nehmen wir also an wir haben eine neue Tabelle pos mit zwei Spalten word und type. Die Spalte type enthält Werte wie "adjective", "noun", "verb" usw. Wir können die beiden Tabellen nun zusammen joinen, um die Daten anzureichern:

select t.word, p.type
from tweets_stop t
left join pos p
  on p.word = t.word

Im Ergebnis bekommen wir nun zu jedem Wort die Information, ob es sich um ein Verb, Adverb, Adjektiv oder Substantiv handelt. Wenn das Wort nicht in der Tabelle pos vorhanden ist, dann ist der Wert der Spalte type gleich null.

Achtung: Ein Wort wie "organic" ist in der POS-Liste als Substantiv und Adjektiv gelistet, was korrekt ist. Wir bekommen in solchen Fällen im Ergebnis 2 Zeilen.

Wenn wir auch den letzten Schritt als View definieren sind wir am Ziel:

create or replace view tweets_pos as
  select t.word, p.type
  from tweets_stop t
  left join pos p
    on p.word = t.word

Auch bei der POS-Liste ist das Auslagern in ein Google Spreadsheet sinnvoll, um die Liste flexibel erweitern zu können. Die Infos dazu bekommt ihr in der Veranstaltung.

Schritt 4