forked from GitHub/gf-core
negative patterns in gfmorpho
This commit is contained in:
@@ -72,13 +72,17 @@ cleanTablePlain = map clean where
|
|||||||
clean w = case w of
|
clean w = case w of
|
||||||
"=>" -> "\t"
|
"=>" -> "\t"
|
||||||
"s" -> ""
|
"s" -> ""
|
||||||
"." -> ""
|
"." -> ""
|
||||||
_ -> cleanw w
|
_ -> cleanw w
|
||||||
cleanw = filter (flip notElem "()")
|
cleanw = filter (flip notElem "()")
|
||||||
|
|
||||||
grep oo wss = filter (\ws -> all (flip matchIn ws) (map tail oo)) wss
|
grep oo wss = filter (\ws -> all (flip matchIn ws) oo) wss
|
||||||
|
|
||||||
matchIn p ws = any (match p) ws where
|
matchIn p ws = quant (matchPol pol patt) ws where
|
||||||
|
quant = if pol then any else all
|
||||||
|
(pol,patt) = (head p == '-', tail p)
|
||||||
|
matchPol True p w = match p w
|
||||||
|
matchPol False p w = not (match p w)
|
||||||
match p w = case (p,w) of
|
match p w = case (p,w) of
|
||||||
('*':ps,_ ) -> any (match ps) [drop i w | i <- [0..length w]] ---
|
('*':ps,_ ) -> any (match ps) [drop i w | i <- [0..length w]] ---
|
||||||
(c:ps, d:ws) -> c == d && match ps ws
|
(c:ps, d:ws) -> c == d && match ps ws
|
||||||
@@ -87,7 +91,7 @@ matchIn p ws = any (match p) ws where
|
|||||||
tmpFile = "_gfmorpho.tmp"
|
tmpFile = "_gfmorpho.tmp"
|
||||||
tmpCommand = "_gfcommand.tmp"
|
tmpCommand = "_gfcommand.tmp"
|
||||||
|
|
||||||
isOption = (=='-') . head
|
isOption = (flip elem "-~") . head
|
||||||
|
|
||||||
tag t s = "<" ++ t ++ ">" ++ s ++ "</" ++ t ++ ">"
|
tag t s = "<" ++ t ++ ">" ++ s ++ "</" ++ t ++ ">"
|
||||||
|
|
||||||
|
|||||||
@@ -3,5 +3,5 @@
|
|||||||
echo "Content-type: text/html";
|
echo "Content-type: text/html";
|
||||||
echo ""
|
echo ""
|
||||||
export LANG=en_US.UTF-8
|
export LANG=en_US.UTF-8
|
||||||
runghc GFMorpho "$QUERY_STRING"
|
export GF_LIB_PATH=/home/aarne/GF/lib/
|
||||||
|
/usr/local/bin/runghc GFMorpho "$QUERY_STRING"
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
Give language, part of speech, and one or more word forms, to obtain
|
Give language, part of speech, and one or more word forms, to obtain
|
||||||
the inflection table.
|
the inflection table.
|
||||||
<p>
|
<p>
|
||||||
<form method=get action="gfmorpho.cgi">
|
<form method=get action="cgi-bin/gfmorpho.cgi">
|
||||||
<input name=args>
|
<input name=args>
|
||||||
<INPUT TYPE=SUBMIT VALUE="Submit">
|
<INPUT TYPE=SUBMIT VALUE="Submit">
|
||||||
</form>
|
</form>
|
||||||
@@ -25,7 +25,7 @@ Examples:
|
|||||||
Lat A vetus veteris
|
Lat A vetus veteris
|
||||||
</pre>
|
</pre>
|
||||||
Thus notice that strings are given without quotes, but features
|
Thus notice that strings are given without quotes, but features
|
||||||
are prefixed with an underscore <tt>_</tt> (a temporary hack).
|
are prefixed with an underscore <tt>_</tt>.
|
||||||
|
|
||||||
|
|
||||||
<h2>Languages and part of speech tags</h2>
|
<h2>Languages and part of speech tags</h2>
|
||||||
@@ -50,24 +50,36 @@ inflection table from the forms given. For a vast majority of words in
|
|||||||
all languages, it is enough to give just one form. But sometimes more
|
all languages, it is enough to give just one form. But sometimes more
|
||||||
forms are needed to get the inflection table right.
|
forms are needed to get the inflection table right.
|
||||||
|
|
||||||
|
<p>
|
||||||
|
|
||||||
|
This is a front end to the Paradigms modules in the GF Resource Grammar.
|
||||||
|
See <a href=http://grammaticalframework.org/lib/doc/synopsis.html>RGL
|
||||||
|
Synopsis</a> for more information on available languages and paradigms.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<h2>Filtering with patterns</h2>
|
<h2>Filtering with patterns</h2>
|
||||||
|
|
||||||
You may not want to see the whole table. Then you can filter it with patterns, each of which works like
|
You may not want to see the whole table.
|
||||||
|
Then you can filter it with patterns, each of which works like
|
||||||
"grep", using <tt>*</tt> to match any substring, either in the
|
"grep", using <tt>*</tt> to match any substring, either in the
|
||||||
features or in the forms:
|
features or in the forms:
|
||||||
<pre>
|
<pre>
|
||||||
Eng N baby -Gen
|
Eng N baby -Gen
|
||||||
Eng V die -dy*
|
Eng V die -dy*
|
||||||
</pre>
|
</pre>
|
||||||
This is a front end to the Paradigms modules in the GF Resource Grammar.
|
If several pattern are given, they are applied in conjunction.
|
||||||
See <a href=http://grammaticalframework.org/lib/doc/synopsis.html>RGL
|
Patterns prefixed with a tilde <tt>~</tt> rather than a hyphen
|
||||||
Synopsis</a> for available languages and paradigms.
|
<tt>-</tt> are checked for <i>not</i> matching. Thus the search
|
||||||
|
<pre>
|
||||||
|
Eng N baby -Gen ~Pl
|
||||||
|
</pre>
|
||||||
|
selects the lines that contain <tt>Gen</tt> but not <tt>Pl</tt>.
|
||||||
|
|
||||||
|
|
||||||
<h2>Using custom paradigms</h2>
|
<h2>Using custom paradigms</h2>
|
||||||
|
|
||||||
(Another temporary hack, for GF experts:) If you want to use other paradigms than the smart
|
(For GF experts.) If you want to use other paradigms than the smart
|
||||||
<tt>mk</tt> paradigms, you can prefix your input with <tt>!</tt> and
|
<tt>mk</tt> paradigms, you can prefix your input with <tt>!</tt> and
|
||||||
use the normal expression syntax of GF. For example:
|
use the normal expression syntax of GF. For example:
|
||||||
<pre>
|
<pre>
|
||||||
|
|||||||
Reference in New Issue
Block a user