-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add noun-possessives morpho paradigm. Add route for obtaining paradig…
…ms and their inputs.
- Loading branch information
1 parent
0330f95
commit 1d388c2
Showing
4 changed files
with
209 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
var extend = require('extend') | ||
module.exports = { | ||
|
||
sourceKey: 'Camilleri2020', | ||
|
||
inflect: function (body, callback) { | ||
var lemma = body.lemma // omm | ||
if (!lemma) { | ||
return callback(new Error('No lemma provided'), null) | ||
} | ||
|
||
let stem | ||
if (lemma.endsWith('a')) { // kelma | ||
stem = lemma.slice(0, -1) + 't' // kelmt- | ||
} else { | ||
stem = lemma | ||
} | ||
var forms = [ | ||
{ | ||
'surface_form': stem.endsWith('u') ? `${stem}wi` : `${stem}i`, // nannuwi, ommi | ||
'possessor': { 'person': 'p1', 'number': 'sg' } | ||
}, | ||
{ | ||
'surface_form': stem.match(/[aeiou]$/) ? `${stem}k` : stem.includes('o') ? `${stem}ok` : `${stem}ek`, // nannuk, ommok, kelmtek | ||
'possessor': { 'person': 'p2', 'number': 'sg' } | ||
}, | ||
{ | ||
'surface_form': stem.match(/[aeiou]$/) ? `${stem}h` : `${stem}u`, // nannuh, ommu | ||
'possessor': { 'person': 'p3', 'number': 'sg', 'gender': 'm' } | ||
}, | ||
{ | ||
'surface_form': `${stem}ha`, // ommha | ||
'possessor': { 'person': 'p3', 'number': 'sg', 'gender': 'f' } | ||
}, | ||
{ | ||
'surface_form': `${stem}na`, // ommna | ||
'possessor': { 'person': 'p1', 'number': 'pl' } | ||
}, | ||
{ | ||
'surface_form': `${stem}kom`, // ommkom | ||
'possessor': { 'person': 'p2', 'number': 'pl' } | ||
}, | ||
{ | ||
'surface_form': `${stem}hom`, // ommhom | ||
'possessor': { 'person': 'p3', 'number': 'pl' } | ||
} | ||
] | ||
var extras = { | ||
'sources': [this.sourceKey] | ||
} | ||
if (body.hasOwnProperty('gender')) { | ||
extras['gender'] = body.gender | ||
} | ||
if (body.hasOwnProperty('number')) { | ||
extras['number'] = body.number | ||
} | ||
for (let f in forms) { | ||
extend(true, forms[f], extras) | ||
} | ||
|
||
callback(null, forms) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters