static function faireObjetRacine($valeurs) { $champs = 'morpheme;variant;no;type;nature;per;number;engMean;freMean;composition;condOnNext;END'; $champs = 'dbName;tableName;' . $champs; $valeurs = 'Inuktitut;Racines;' . $valeurs; return LinguisticObjects::makeLinguisticObject_from_FieldsAndValues($champs, $valeurs); }
public function test__surfaceFormOnOneStem_2_morphemes() { $stem = 'aariaq'; $morpheme1 = LinguisticObjects::getObject('galaq/1nn'); $morpheme2 = LinguisticObjects::getObject('it/tn-nom-p'); $radicaux = $this->object->_surfaceFormOnOneStem($stem, array($morpheme1, $morpheme2)); $att = array('aariagalait'); $this->assertEquals($att, $radicaux, ""); }
public function __construct($list_of_morpheme_ids) { $logger = Logger::getLogger('Word.__construct'); $list_of_morphemes = array(); foreach ($list_of_morpheme_ids as $a_morpheme_id) { $logger->debug("\$a_morpheme_id= '{$a_morpheme_id}'"); $object = LinguisticObjects::getObject($a_morpheme_id); $logger->debug("id de l'objet : '" . $object->id() . "'"); array_push($list_of_morphemes, $object); } $this->morphemes = $list_of_morphemes; }
public function test_expressionOfComposition() { $ligne_suffixe = 'innaq;2;sv;vv;m;n;;;;innaq;n-i(ng);n;i(ng);innaq;s-i(ng);s;i(ng);innaq;s-i(ng);s;i(ng);innaq;s-i(ng);s;i(ng);to do nothing but;;;;;;;;'; $ligne_champs = 'morpheme;key;type;function;position;transitivity;nature;plural;antipassive;V-form;V-actions;V-action1;V-action2;t-form;t-actions;t-action1;t-action2;k-form;k-actions;k-action1;k-action2;q-form;q-actions;q-action1;q-action2;engMean;freMean;condPrec;condPrecTrans;condOnNext;sources;composition;dialect;mobility'; $suffixe = LinguisticObjects::makeLinguisticObject_from_FieldsAndValues($ligne_champs, $ligne_suffixe); $stem = '___VV'; $res = $suffixe->expressionOfComposition($stem); $att = array('___VV + innaq > ___VVnginnaq'); $this->assertEquals($att, $res, "Erreur"); $stem = '___k'; $res = $suffixe->expressionOfComposition($stem); $att = array('___k + innaq > ___innaq'); $this->assertEquals($att, $res, "Erreur"); $stem = '___VVk'; $res = $suffixe->expressionOfComposition($stem); $att = array('___VVk + innaq > ___VVnginnaq'); $this->assertEquals($att, $res, "Erreur"); }
<?php /* * Created on 2011-01-24 * * To change the template for this generated file go to * Window - Preferences - PHPeclipse - PHP - Code Templates */ require_once "lib/log4php/Logger.php"; Logger::configure(getenv('PHP_INUKTITUT') . '/log4php.properties.xml'); require_once 'linguisticobjects/LinguisticObjects.php'; if ($argc < 2) { usage(); die; } $objectId = $argv[1]; $valeurs = LinguisticObjects::findLinguisticDataInIndex($objectId); // ex.: 'saqqik/1v' print_r($valeurs); function usage() { echo "\nusage: php -c . searchIndex.php <morphemeId>\n"; echo "\n\t<morphemeId>\tmorpheme identifier, eg saqqik/1v\n"; }
function faireObjetRacine($valeurs) { $champs = 'morpheme;variant;key;type;transitivity;nature;number;compositionRoot;plural;intransSuffix;transSuffix;antipassive;engMean;freMean;source;dialect;cf;END'; $champs = 'dbName;tableName;' . $champs; $valeurs = 'Inuktitut;Racines;' . $valeurs; return LinguisticObjects::makeLinguisticObject_from_FieldsAndValues($champs, $valeurs); }
<?php /* * Created on 2010-11-10 * * To change the template for this generated file go to * Window - Preferences - PHPeclipse - PHP - Code Templates */ set_include_path('..'); require_once "lib/parseCSV.php"; require_once "linguisticobjects/LinguisticObjects.php"; echo "Get French Meanings of Verb Roots\n"; $fd = fopen('c:/eclipse_workspace/InuktitutNew-PHP/linguisticdata/RootsSpalding.csv', 'r'); $premiereLigne = fgets($fd); $champs = explode(',', trim($premiereLigne)); while (($ligne = fgets($fd)) != null) { // echo "\$ligne= '$ligne'"; $champsValeurs = parseCSV(trim($ligne), $champs); $champsValeurs['dbName'] = 'Inuktitut'; $champsValeurs['tableName'] = $tableName; $object = LinguisticObjects::makeLinguisticObject($champsValeurs); if ($object != null) { if ($object->getType() == 'v') { echo $object->id() . ' : ' . $object->getFrenchMeaning() . "\n"; } } } close($fd);
<?php require_once "linguisticobjects/LinguisticObjects.php"; require_once "lib/log4php/Logger.php"; Logger::configure(getenv('PHP_INUKTITUT') . '/log4php.properties.xml'); $logger = Logger::getLogger('getAllTransitiveVerbs'); $roots = LinguisticObjects::listOfRoots(); foreach ($roots as $a_root_id) { $logger->debug("\$a_root_id= {$a_root_id}"); $root_object = LinguisticObjects::getObject($a_root_id); if ($root_object->type() === 'v') { if ($root_object->isTransitiveVerb()) { $en_meaning = $root_object->getEnglishMeaning(); echo "{$a_root_id} --- {$en_meaning}\n"; } } }
function _do_index_this_file($csv_filename) { $logger = Logger::getLogger('Indexer._do_index_this_file'); $full_data_filename = realpath($this->_data_root . DIRECTORY_SEPARATOR . $csv_filename); // $logger->debug("\$full_data_filename= '$full_data_filename"); $this->_nb_indexed_files += 1; $fih = fopen("{$full_data_filename}", 'r'); $index_file_name = "{$full_data_filename}" . '.index'; $foh = fopen($index_file_name, 'w'); preg_match("/(^|\\\\|\\/)([^\\\\\\/]+)\\.csv/", $full_data_filename, $matches); $tableName = $matches[2]; // $logger->debug("nom de la table = '$tableName'"); $ligne_champs = fgets($fih); // $logger->debug("\$ligne_champs = '$ligne_champs'"); $position = ftell($fih); $this->_nb_indexed_entries_in_individual_file = 0; while (($ligne_valeurs = fgets($fih)) != NULL) { $this->_nb_indexed_entries += 1; $this->_nb_indexed_entries_in_individual_file += 1; $champsValeurs = parseCSV($ligne_champs, $ligne_valeurs); $champsValeurs['dbName'] = 'Inuktitut'; $champsValeurs['tableName'] = $tableName; // $object = LinguisticObjects::makeLinguisticObject($champsValeurs); $object_ids = LinguisticObjects::make_object_ids($champsValeurs); // $logger->debug("\$object_ids= ".print_r($object_ids,TRUE)); foreach ($object_ids as $an_id) { $entry = $an_id->toString() . ':' . $position . "\n"; fputs($foh, $entry); } $position = ftell($fih); } fclose($fih); fclose($foh); return $index_file_name; }