New in Wolfram
Mathematica
8: Dynamic Library Loading
◄
previous
|
next
►
Software Development
Call to External C Libraries
Porter stemming finds the stem of an English word. For example, the word "govern" is the stem of "governor", "government", and so on. Here, external C code for linguistic tools is called from
Mathematica
.
In[1]:=
X
srcf = FileNameJoin[{NotebookDirectory[], "stem.c"}]; lib = CreateLibrary[{srcf}, "stem"]; stem = LibraryFunctionLoad[lib, "doStem", {"UTF8String"}, "UTF8String"]; doi = StringSplit[ExampleData[{"Text", "DeclarationOfIndependence"}], Whitespace];
In[2]:=
X
Sort[Tally[stem /@ doi], Last[#1] > Last[#2] &][[;; 50]]
Out[2]=