-- Sep 25 In-Class Exercise Thread
<?php
namespace cpollett\test_composer;
use seekquarry\yioop\configs as SYC;
use seekquarry\yioop\library as SYL;
use seekquarry\yioop\library\PhraseParser;
require_once "vendor/autoload.php";
$tmp = "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";
$tmp1 = "second world war";
PhraseParser::hyphenateEntities($tmp, 'en-US');
PhraseParser::hyphenateEntities($tmp1,'en-US');
echo "\nHyphenated String1: === ";
echo $tmp;
echo "\nHyphanated String2: === ";
echo $tmp1;
echo "\n";
print_r(PhraseParser::stemTerms($tmp, 'en-US'));
print_r(PhraseParser::stemTerms($tmp1, 'en-US'));
Ouput:
(base) C02Z63W4LVDL:hyphen aparna.kale$ php index.php
Hyphenated String1: === 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
Hyphanated String2: === second world-war
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
)
Array
(
[0] => second
[1] => world-war
)
(base) C02Z63W4LVDL:hyphen aparna.kale$
(
Edited: 2019-09-25)
<?php
namespace cpollett\test_composer;
use seekquarry\yioop\configs as SYC;
use seekquarry\yioop\library as SYL;
use seekquarry\yioop\library\PhraseParser;
require_once "vendor/autoload.php";
$tmp = "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";
$tmp1 = "second world war";
PhraseParser::hyphenateEntities($tmp, 'en-US');
PhraseParser::hyphenateEntities($tmp1,'en-US');
echo "\nHyphenated String1: === ";
echo $tmp;
echo "\nHyphanated String2: === ";
echo $tmp1;
echo "\n";
print_r(PhraseParser::stemTerms($tmp, 'en-US'));
print_r(PhraseParser::stemTerms($tmp1, 'en-US'));
'''Ouput:'''
(base) C02Z63W4LVDL:hyphen aparna.kale$ php index.php
Hyphenated String1: === 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
Hyphanated String2: === second world-war
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
)
Array
(
[0] => second
[1] => world-war
)
(base) C02Z63W4LVDL:hyphen aparna.kale$