Geocoding: Sentiment Analysis (Part 5)

by Jun 27, 2019

Some geocoding APIs provide sophisticated sentiment analysis like in the example below:

"Most important museums of Amsterdam are located on the Museumplein, located at the southwestern side of the Rijksmuseum." |
  ForEach-Object -Begin {$url='https://geocode.xyz'
    $null = Invoke-RestMethod $url -S session
  } -Process {
    Invoke-RestMethod $url -W $session -Method Post -Body @{scantext=$_='json'='analysis'}
  }

A text is sent to the API, and the API analyzes geographic content and outputs details for the locations found in the text:

 
sentimentanalysis : @{allsentiments=; sentimentwords=; mainsentiment=}
longt             : 4.88702
matches           : 3
match             : {@{longt=4.88355; location=RIJKSMUSEUM, AMSTERDAM, NL; matchtype=street; 
                    confidence=1.0; MentionIndices=108,26; latt=52.35976}, @{longt=4.88334; 
                    location=MUSEUMPLEIN, AMSTERDAM, NL; matchtype=street; confidence=1.0; 
                    MentionIndices=55,26; latt=52.35747}, @{longt=4.89416; location=Amsterdam,NL; 
                    matchtype=locality; confidence=0.4; MentionIndices=26; latt=52.36105}}
latt              : 52.35943
 

Twitter This Tip! ReTweet this Tip!