File: demo_NUM.pl

package info (click to toggle)
liblingua-en-inflect-perl 1.905-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 448 kB
  • sloc: perl: 1,462; makefile: 2
file content (23 lines) | stat: -rwxr-xr-x 528 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#! /usr/bin/perl -ws

use Lingua::EN::Inflect qw { classical NUM inflect };
use vars qw { $classical $modern };

classical if $classical && !$modern;

print "count inflection> ";
while (<>)
{
	chomp;
	exit if /^\.$/;
	if (/^\-classical$/)	{ classical ; print "[going classical]"}
	elsif (/^-modern$/)	{ classical 0; print "[going modern]" }
	else			
	{
		/\s*(\S+)\s+(.*)/ and
			print "            ", NUM($1), " ", inflect($2), "\n"
		or /\s*(\S*)/ and
			print "            ", inflect($1), "\n";
	}
	print "\ncount word> ";
}