Difference between revisions of "Spring 2017/MorphTests2yaml"

From LING073
Jump to: navigation, search
Line 1: Line 1:
 +
You can install '''morphTests2yaml''' as follows:
 +
<pre>
 +
cd ~/Source
 +
git clone git@github.swarthmore.edu:Ling073-sp17/tools.git
 +
cd tools
 +
sudo make install
 +
</pre>
  
−
  top="Config:\n  hfst:\n    App: hfst-lookup\n    Gen: ../xyz.autogen.hfst\n    Morph: ../crh.automorf.hfst\n\nTests:\n"
+
You can scrape <code><NOWIKI>{{morphTest}}</NOWIKI></code>s from any page on this wiki like this:
−
  tests=`curl -s "https://wikis.swarthmore.edu/ling073/api.php?action=query&prop=revisions&rvprop=content&format=txt&titles=Language/Grammar" | perl -pe 's/\{\{tag\|(.*?)\}\}/<\1>/g' | grep -Po '{{morphTest.*?}}|\=.*=' | perl -pe 's/\{\{morphTest\|(.*?)\|(.*?)\}\}/   \1 : \2/g' | sed -r 's/\=+([^=]+)\=+/ "\1":/g'`
+
  morphTests2yaml "Language/Grammar" -l xyz
−
  echo $top$tests
 
−
 
 
−
No, that doesn't work, though it was a nice little experiment.
 
−
 
 
−
See [https://github.swarthmore.edu/Ling073-sp17/tools/blob/master/morphTests2yaml.py morphTests2yaml.py] instead.
 

Revision as of 10:24, 9 February 2017

You can install morphTests2yaml as follows:

cd ~/Source
git clone git@github.swarthmore.edu:Ling073-sp17/tools.git
cd tools
sudo make install

You can scrape {{morphTest}}s from any page on this wiki like this:

morphTests2yaml "Language/Grammar" -l xyz