how to extract listed names (placenames) from a text?
<p>I would like to extract placenames from a text and geolocate them on a map - automatically with R. The first step would be to extract the placenames.</p>

<p>I downloaded a list of placenames (from <a href="http://download.geonames.org/export/dump/" rel="nofollow">geonames</a>); but how do I match the words from the geonames-placename-list within the text?</p>

<p>The possibility with <code>intersect()</code> does work only, when I convert the text to a vector - and therefore need to split the text into words, which causes the match-operator to only find one-word-placenames like "berlin" but not "new york" etc.</p>

<p>Does a function to compare a list with text (as string) exist?</p>

<p>MWE:</p>

<pre><code>list = c("Wien", "London", "New York")
text = "Er sah den Stadtplan von Wien in New York."
words = unlist(strsplit(text, "\\W"))
intersect(list, words)
</code></pre>

<p>results in only:</p>

<pre><code>&gt; [1] "Wien"
</code></pre>