Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stemmer/fr: restored & completed carry.js from original publication #137

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions src/stemmers/french/carry-spec2js.awk
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Generates javascript code from Carry specification publication
# curl -s http://www.otlet-institute.org/docs/Carry.pdf | pdftotext -f 6 -layout -nopgbrk - - | awk -f carry-spec2js.awk
# 2017, Raphaël Droz
{
if ($0 ~ /^ +[0-9]+$/) next; # page number
if ($0 ~ /A\..*Étape/) { # step number
if (gotstep) print("];\n");
gotstep = 1;
printf("const STEP%d = [\n", $3);
next;
}
# empty lines
if ($0 ~ /^[[:space:]]*$/) next;
# page 6
if (! gotstep) next;
sub(/^[[:space:]]*/, "");
# line pattern: (m > N) SUFF SUBST|ε
# $3 $4 $5
if ($5 == "ε") printf(" [%d, '%s'],\n", $3, $4);
else printf(" [%d, '%s', '%s'],\n", $3, $4, $5);
}
END { print("];"); }
274 changes: 252 additions & 22 deletions src/stemmers/french/carry.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,6 @@ const STEP1 = [
[1, 'ation'],
[0, 'ition'],
[0, 'tion'],
[1, 'ateur'],
[1, 'teur'],
[0, 'eur'],
[0, 'ier'],
[0, 'er'],
[0, 'ir'],
[0, 'r'],
Expand Down Expand Up @@ -124,7 +120,6 @@ const STEP1 = [
[0, 'aux', 'al'],
[0, 'x'],
[0, 'issante'],
[1, 'atrice'], // Added
[0, 'eresse'],
[0, 'eante'],
[0, 'easse'],
Expand All @@ -135,16 +130,14 @@ const STEP1 = [
[0, 'ence'],
[0, 'aise'],
[0, 'euse'],
[0, 'oise', 'o'],
[0, 'oise'],
[0, 'isse'],
[0, 'ante'],
[0, 'ouse', 'ou'],
[0, 'ière'],
[0, 'ete'],
[0, 'ète'],
[0, 'iere'],
[0, 'aire'],
[1, 'ure'],
[0, 'erie'],
[0, 'étude'],
[0, 'etude'],
Expand Down Expand Up @@ -181,7 +174,6 @@ const STEP1 = [
[0, 'eresses'],
[0, 'issions'],
[0, 'assions'],
[1, 'atrices'], // Added
[1, 'iations'],
[0, 'issants'],
[0, 'ussions'],
Expand All @@ -194,8 +186,6 @@ const STEP1 = [
[0, 'etudes'],
[0, 'itudes'],
[0, 'issais'],
[0, 'trices'],
[0, 'eilles', 'eil'],
[0, 'irions'],
[0, 'erions'],
[1, 'ateurs'],
Expand All @@ -218,7 +208,7 @@ const STEP1 = [
[0, 'esses'],
[0, 'euses'],
[0, 'ulles', 'ul'],
[0, 'cques', 'c'],
[0, 'cques'],
[0, 'elles'],
[0, 'ables'],
[0, 'istes'],
Expand All @@ -244,10 +234,7 @@ const STEP1 = [
[0, 'etes'],
[0, 'ions'],
[0, 'ités'],
[0, 'ites'],
[0, 'ates'],
[0, 'âtes'],
[0, 'îtes'],
[0, 'îtés'],
[0, 'eurs'],
[0, 'iers'],
[0, 'iras'],
Expand Down Expand Up @@ -280,29 +267,272 @@ const STEP1 = [
[0, 'és'],
[0, 'is'],
[0, 's'],
[0, 'eau'],
[0, 'ea'],
[0, 'au']
];

const STEP2 = [
[1, 'ent'],
[1, 'ation'],
[1, 'ition'],
[1, 'tion'],
[1, 'ent'],
[1, 'el'],
[0, 'i']
];

const STEP3 = [
[0, 'nn', 'n'],
[0, 'll', 'l'],
[0, 'mm', 'm'],
[0, 'tt', 't'],
[0, 'y'],
[0, 't'],
[0, 'qu', 'c'],
[0, 'gu', 'g'],
[0, 'issaient'],
[0, 'ellement', 'el'],
[0, 'issement'],
[0, 'alement', 'al'],
[0, 'eraient'],
[0, 'iraient'],
[0, 'eassent'],
[0, 'ussent'],
[0, 'amment'],
[0, 'emment'],
[0, 'issant'],
[0, 'issent'],
[0, 'assent'],
[0, 'eaient'],
[0, 'issait'],
[0, 'èrent'],
[0, 'erent'],
[0, 'irent'],
[0, 'erait'],
[0, 'irait'],
[0, 'iront'],
[0, 'eront'],
[0, 'ement'],
[0, 'aient'],
[0, 'îrent'],
[0, 'eont'],
[0, 'eant'],
[0, 'eait'],
[0, 'ient'],
[0, 'ent'],
[0, 'ont'],
[0, 'ant'],
[0, 'eât'],
[0, 'ait'],
[0, 'at'],
[0, 'ât'],
[0, 'it'],
[0, 'ît'],
[0, 't'],
[0, 'uction'],
[1, 'ication'],
[1, 'iation'],
[1, 'ation'],
[0, 'ition'],
[0, 'tion'],
[0, 'ateur'],
[1, 'teur'],
[0, 'ier'],
[0, 'er'],
[0, 'ir'],
[0, 'r'],
[0, 'eassiez'],
[0, 'issiez'],
[0, 'assiez'],
[0, 'ussiez'],
[0, 'issez'],
[0, 'assez'],
[0, 'eriez'],
[0, 'iriez'],
[0, 'erez'],
[0, 'irez'],
[0, 'iez'],
[0, 'ez'],
[0, 'erai'],
[0, 'irai'],
[0, 'eai'],
[0, 'ai'],
[0, 'i'],
[0, 'ira'],
[0, 'era'],
[0, 'ea'],
[0, 'a'],
[0, 'f', 'v'],
[0, 'yeux', 'oeil'],
[0, 'eux'],
[0, 'aux', 'al'],
[0, 'x'],
[0, 'issante'],
[0, 'eresse'],
[0, 'eante'],
[0, 'easse'],
[0, 'eure'],
[0, 'esse'],
[0, 'asse'],
[0, 'ance'],
[0, 'ence'],
[0, 'aise'],
[0, 'oise'],
[0, 'isse'],
[0, 'ante'],
[0, 'ouse', 'ous'],
[0, 'ière'],
[0, 'esse'],
[0, 'ete'],
[0, 'ète'],
[0, 'aire'],
[1, 'ure'],
[0, 'erie'],
[0, 'étude'],
[0, 'etude'],
[0, 'itude'],
[0, 'ade'],
[0, 'isme'],
[0, 'age'],
[0, 'trice'],
[0, 'cque', 'c'],
[0, 'que', 'c'],
[0, 'eille', 'eil'],
[0, 'elle'],
[0, 'able'],
[0, 'iste'],
[0, 'ulle', 'ul'],
[0, 'gue', 'g'],
[0, 'ette'],
[0, 'nne', 'n'],
[0, 'itée'],
[0, 'ité'],
[0, 'té'],
[0, 'ée'],
[0, 'é'],
[0, 'usse'],
[0, 'aise'],
[0, 'ate'],
[0, 'ite'],
[0, 'ee'],
[0, 'e'],
[0, 'issements'],
[0, 'issantes'],
[1, 'ications'],
[0, 'eassions'],
[0, 'eresses'],
[0, 'issions'],
[0, 'assions'],
[1, 'iations'],
[0, 'issants'],
[0, 'ussions'],
[0, 'ements'],
[0, 'eantes'],
[0, 'issons'],
[0, 'assons'],
[0, 'easses'],
[0, 'études'],
[0, 'etudes'],
[0, 'itudes'],
[0, 'issais'],
[0, 'trices'],
[0, 'eilles', 'eil'],
[0, 'irions'],
[0, 'erions'],
[1, 'ateurs'],
[1, 'ations'],
[0, 'usses'],
[0, 'tions'],
[0, 'ances'],
[0, 'entes'],
[1, 'teurs'],
[0, 'eants'],
[0, 'ables'],
[0, 'irons'],
[0, 'irais'],
[0, 'ences'],
[0, 'ients'],
[0, 'ieres'],
[0, 'eures'],
[0, 'aires'],
[0, 'erons'],
[0, 'esses'],
[0, 'euses'],
[0, 'ulles', 'ul'],
[0, 'cques', 'c'],
[0, 'elles'],
[0, 'ables'],
[0, 'istes'],
[0, 'aises'],
[0, 'asses'],
[0, 'isses'],
[0, 'oises', 'o'],
[0, 'tions'],
[0, 'ouses', 'ou'],
[0, 'ières'],
[0, 'eries'],
[0, 'antes'],
[0, 'ismes'],
[0, 'erais'],
[0, 'eâtes'],
[0, 'eâmes'],
[0, 'itées'],
[0, 'ettes'],
[0, 'ages'],
[0, 'eurs'],
[0, 'ents'],
[0, 'ètes'],
[0, 'etes'],
[0, 'ions'],
[0, 'ités'],
[0, 'ites'],
[0, 'ates'],
[0, 'îtes'],
[0, 'eurs'],
[0, 'iers'],
[0, 'iras'],
[0, 'eras'],
[1, 'ures'],
[0, 'ants'],
[0, 'îmes'],
[0, 'ûmes'],
[0, 'âmes'],
[0, 'ades'],
[0, 'eais'],
[0, 'eons'],
[0, 'ques', 'c'],
[0, 'gues', 'g'],
[0, 'nnes', 'n'],
[0, 'ttes'],
[0, 'îtes'],
[0, 'tés'],
[0, 'ons'],
[0, 'ais'],
[0, 'ées'],
[0, 'ees'],
[0, 'ats'],
[0, 'eas'],
[0, 'ts'],
[0, 'rs'],
[0, 'as'],
[0, 'es'],
[0, 'fs', 'v'],
[0, 'és'],
[0, 'is'],
[0, 's'],
[0, 'eau'],
[0, 'au'],
[1, 'ent'],
[1, 'ation'],
[1, 'ition'],
[1, 'tion'],
[1, 'el'],
[0, 'i'],
[0, 'nn', 'n'],
[0, 'pp', 'p'],
[0, 'll', 'l'],
[0, 'tt', 't'],
[0, 'ss', 's'],
[0, 'y'],
[0, 't'],
[0, 'qu', 'c']
[0, 'qu', 'c'],
[0, 'gu', 'g']
];

/**
Expand Down