-- Mar 10 In-Class Exercise Thread
Code (test.php)
<?php
use seekquarry\yioop\Library as L;
use seekquarry\yioop\library\Library;
use seekquarry\yioop\library\PhraseParser;
require_once "vendor/autoload.php";
Library::init();
$phrase = "For many years after their introduction, vacuum cleaners remained a luxury item, but after the Second World War they became common among the middle classes";
$locale = "en-US";
print_r(PhraseParser::stemTerms($phrase, $locale));
?>
Result:
Array
(
[0] => For
[1] => mani
[2] => year
[3] => after
[4] => their
[5] => introduction,
[6] => vacuum
[7] => cleaner
[8] => remain
[9] => a
[10] => luxuri
[11] => item,
[12] => but
[13] => after
[14] => the
[15] => Second
[16] => World
[17] => War
[18] => thei
[19] => becam
[20] => common
[21] => among
[22] => the
[23] => middl
[24] => class
)
(
Edited: 2021-03-10)
Code (test.php)
<?php
use seekquarry\yioop\Library as L;
use seekquarry\yioop\library\Library;
use seekquarry\yioop\library\PhraseParser;
require_once "vendor/autoload.php";
Library::init();
$phrase = "For many years after their introduction, vacuum cleaners remained a luxury item, but after the Second World War they became common among the middle classes";
$locale = "en-US";
print_r(PhraseParser::stemTerms($phrase, $locale));
?>
----
Result:
Array
(
[0] => For
[1] => mani
[2] => year
[3] => after
[4] => their
[5] => introduction,
[6] => vacuum
[7] => cleaner
[8] => remain
[9] => a
[10] => luxuri
[11] => item,
[12] => but
[13] => after
[14] => the
[15] => Second
[16] => World
[17] => War
[18] => thei
[19] => becam
[20] => common
[21] => among
[22] => the
[23] => middl
[24] => class
)