Files
gf-core/lib/resource/doc/gfdoc/Numeral.html
2007-12-12 20:30:11 +00:00

80 lines
2.8 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<META NAME="generator" CONTENT="http://txt2tags.sf.net">
<TITLE> Numerals</TITLE>
</HEAD><BODY BGCOLOR="white" TEXT="black">
<P ALIGN="center"><CENTER><H1> Numerals</H1>
<FONT SIZE="4">
<I>Last update: 2006-06-26 13:24:17 CEST</I><BR>
</FONT></CENTER>
<P></P>
<HR NOSHADE SIZE=1>
<P></P>
<P></P>
<HR NOSHADE SIZE=1>
<P></P>
<P>
Produced by
gfdoc - a rudimentary GF document generator.
(c) Aarne Ranta (<A HREF="mailto:aarne@cs.chalmers.se">aarne@cs.chalmers.se</A>) 2002 under GNU GPL.
</P>
<P>
This grammar defines numerals from 1 to 999999.
The implementations are adapted from the
<A HREF="http://www.cs.chalmers.se/~aarne/GF/examples/numerals/">numerals library</A>
which defines numerals for 88 languages.
The resource grammar implementations add to this inflection (if needed)
and ordinal numbers.
</P>
<P>
<B>Note</B> 1. Number 1 as defined
in the category <CODE>Numeral</CODE> here should not be used in the formation of
noun phrases, and should therefore be removed. Instead, one should use
<A HREF="Structural.html">Structural</A><CODE>.one_Quant</CODE>. This makes the grammar simpler
because we can assume that numbers form plural noun phrases.
</P>
<P>
<B>Note</B> 2. The implementations introduce spaces between
parts of a numeral, which is often incorrect - more work on
(un)lexing is needed to solve this problem.
</P>
<PRE>
abstract Numeral = Cat ** {
cat
Digit ; -- 2..9
Sub10 ; -- 1..9
Sub100 ; -- 1..99
Sub1000 ; -- 1..999
Sub1000000 ; -- 1..999999
fun
num : Sub1000000 -&gt; Numeral ;
n2, n3, n4, n5, n6, n7, n8, n9 : Digit ;
pot01 : Sub10 ; -- 1
pot0 : Digit -&gt; Sub10 ; -- d * 1
pot110 : Sub100 ; -- 10
pot111 : Sub100 ; -- 11
pot1to19 : Digit -&gt; Sub100 ; -- 10 + d
pot0as1 : Sub10 -&gt; Sub100 ; -- coercion of 1..9
pot1 : Digit -&gt; Sub100 ; -- d * 10
pot1plus : Digit -&gt; Sub10 -&gt; Sub100 ; -- d * 10 + n
pot1as2 : Sub100 -&gt; Sub1000 ; -- coercion of 1..99
pot2 : Sub10 -&gt; Sub1000 ; -- m * 100
pot2plus : Sub10 -&gt; Sub100 -&gt; Sub1000 ; -- m * 100 + n
pot2as3 : Sub1000 -&gt; Sub1000000 ; -- coercion of 1..999
pot3 : Sub1000 -&gt; Sub1000000 ; -- m * 1000
pot3plus : Sub1000 -&gt; Sub1000 -&gt; Sub1000000 ; -- m * 1000 + n
}
</PRE>
<P></P>
<!-- html code generated by txt2tags 2.3 (http://txt2tags.sf.net) -->
<!-- cmdline: txt2tags -thtml -\-toc abstract/Numeral.txt -->
</BODY></HTML>