2022-03-08

Mar 9 In-Class Exercise.

Please post your solution to the Mar 9 In-Class Exercise to this thread.
Best,
Chris
Please post your solution to the Mar 9 In-Class Exercise to this thread. Best, Chris
2022-03-09

-- Mar 9 In-Class Exercise
<?php 
 
namespace nimesh\test; 
 
use seekquarry\yioop\library\PhraseParser;
require_once "vendor/autoload.php"; 
 
$s = "The prime minister is the head of government for Canada, chairs and selects the membership of the Cabinet, and advises the Crown on the exercise of executive power and much of the royal prerogative.";
PhraseParser::hyphenateEntities($s, 'en-US'); 
 
echo $s; 
 
$res = PhraseParser::stemTerms($s, 'en-US'); 
 
var_dump($res); 
 
(Edited: 2022-03-09)
<pre> <?php namespace nimesh\test; use seekquarry\yioop\library\PhraseParser; require_once "vendor/autoload.php"; $s = "The prime minister is the head of government for Canada, chairs and selects the membership of the Cabinet, and advises the Crown on the exercise of executive power and much of the royal prerogative."; PhraseParser::hyphenateEntities($s, 'en-US'); echo $s; $res = PhraseParser::stemTerms($s, 'en-US'); var_dump($res); </pre>

-- Mar 9 In-Class Exercise
<?php namespace shan\test_composer;
use seekquarry\yioop\library\PhraseParser;
require_once "vendor/autoload.php";
$string = "The prime minister is the head of government for Canada, chairs and selects the membership of the Cabinet, and advises the Crown on the exercise of executive power and much of the royal prerogative."; PhraseParser::hyphenateEntities($string, 'en-US'); echo $string;
$stemmed_terms = PhraseParser::stemTerms($string, 'en-US'); var_dump($stemmed_terms);
<?php namespace shan\test_composer; use seekquarry\yioop\library\PhraseParser; require_once "vendor/autoload.php"; $string = "The prime minister is the head of government for Canada, chairs and selects the membership of the Cabinet, and advises the Crown on the exercise of executive power and much of the royal prerogative."; PhraseParser::hyphenateEntities($string, 'en-US'); echo $string; $stemmed_terms = PhraseParser::stemTerms($string, 'en-US'); var_dump($stemmed_terms);

-- Mar 9 In-Class Exercise
<?php
use seekquarry\yioop\configs as SYC;
use seekquarry\yioop\library as SYL;
use seekquarry\yioop\library\Library;
use seekquarry\yioop\library\PhraseParser; 
 
require_once "vendor/autoload.php"; 
 
Library::init(true);
$var1 = "The prime minister is the head of government for Canada, chairs and selects the membership of the Cabinet, and advises the Crown on the exercise of executive power and much of the royal prerogative. ";
PhraseParser::hyphenateEntities($var1, 'en-US');
echo $var1;
$var2 = PhraseParser::stemTerms($var1, 'en-US');
var_dump($var2); 
 
<pre> <?php use seekquarry\yioop\configs as SYC; use seekquarry\yioop\library as SYL; use seekquarry\yioop\library\Library; use seekquarry\yioop\library\PhraseParser; require_once "vendor/autoload.php"; Library::init(true); $var1 = "The prime minister is the head of government for Canada, chairs and selects the membership of the Cabinet, and advises the Crown on the exercise of executive power and much of the royal prerogative. "; PhraseParser::hyphenateEntities($var1, 'en-US'); echo $var1; $var2 = PhraseParser::stemTerms($var1, 'en-US'); var_dump($var2); </pre>

-- Mar 9 In-Class Exercise
<?php
namespace archit\test;
use seekquarry\yioop\library\Library;
use seekquarry\yioop\library\PhraseParser;
require_once "vendor/autoload.php";
Library::init(true);
$a = "The prime minister is the head of government for Canada, chairs and selects the membership of the Cabinet, and advises the Crown on the exercise of executive power and much of the royal prerogative.";
PhraseParser::hyphenateEntities($a, 'en-US');
echo $a;
echo "\n\n";
$out = PhraseParser::stemTerms($a, 'en-US');
var_dump($out);
(Edited: 2022-03-09)
<?php namespace archit\test; use seekquarry\yioop\library\Library; use seekquarry\yioop\library\PhraseParser; require_once "vendor/autoload.php"; Library::init(true); $a = "The prime minister is the head of government for Canada, chairs and selects the membership of the Cabinet, and advises the Crown on the exercise of executive power and much of the royal prerogative."; PhraseParser::hyphenateEntities($a, 'en-US'); echo $a; echo "\n\n"; $out = PhraseParser::stemTerms($a, 'en-US'); var_dump($out);

-- Mar 9 In-Class Exercise
<?php namespace Users\jitucherian\Downloads\composertest\vendor;
use seekquarry\yioop\configs as SYC; use seekquarry\yioop\library as SYL; use seekquarry\yioop\library\Library; use seekquarry\yioop\library\PhraseParser; use seekquarry\yioop\library\CrawlConstants;
error_reporting(-1); require_once (__DIR__."/vendor/autoload.php"); /*
   Since a normal Yioop instance needs a Profile.php file to be generated,
   the following is used to set up Yioop in library mode so you don't need this.
   To enable debugging use Library::init(true);
 */
Library::init(true); $str = "The prime minister is the head of government for Canada, chairs and selects the membership of the Cabinet, and advises the Crown on the exercise of executive power and much of the royal prerogative."; $lang = "en-US"; PhraseParser::hyphenateEntities($str, $lang); print_r(PhraseParser::stemTerms($str, $lang));
print_r($str);
output:
Array (
    [0] => The
    [1] => prime-minist
    [2] => is
    [3] => the
    [4] => head
    [5] => of
    [6] => govern
    [7] => for
    [8] => Canada,
    [9] => chair
    [10] => and
    [11] => select
    [12] => the
    [13] => membership
    [14] => of
    [15] => the
    [16] => Cabinet,
    [17] => and
    [18] => advis
    [19] => the
    [20] => Crown
    [21] => on
    [22] => the
    [23] => exercis
    [24] => of
    [25] => executive-power
    [26] => and
    [27] => much
    [28] => of
    [29] => the
    [30] => royal
    [31] => prerogative.
) The prime-minister is the head of government for Canada, chairs and selects the membership of the Cabinet, and advises the Crown on the exercise of executive-power and much of the royal prerogative.
<?php namespace Users\jitucherian\Downloads\composertest\vendor; use seekquarry\yioop\configs as SYC; use seekquarry\yioop\library as SYL; use seekquarry\yioop\library\Library; use seekquarry\yioop\library\PhraseParser; use seekquarry\yioop\library\CrawlConstants; error_reporting(-1); require_once (__DIR__."/vendor/autoload.php"); /* Since a normal Yioop instance needs a Profile.php file to be generated, the following is used to set up Yioop in library mode so you don't need this. To enable debugging use Library::init(true); */ Library::init(true); $str = "The prime minister is the head of government for Canada, chairs and selects the membership of the Cabinet, and advises the Crown on the exercise of executive power and much of the royal prerogative."; $lang = "en-US"; PhraseParser::hyphenateEntities($str, $lang); print_r(PhraseParser::stemTerms($str, $lang)); print_r($str); output: Array ( [0] => The [1] => prime-minist [2] => is [3] => the [4] => head [5] => of [6] => govern [7] => for [8] => Canada, [9] => chair [10] => and [11] => select [12] => the [13] => membership [14] => of [15] => the [16] => Cabinet, [17] => and [18] => advis [19] => the [20] => Crown [21] => on [22] => the [23] => exercis [24] => of [25] => executive-power [26] => and [27] => much [28] => of [29] => the [30] => royal [31] => prerogative. ) The prime-minister is the head of government for Canada, chairs and selects the membership of the Cabinet, and advises the Crown on the exercise of executive-power and much of the royal prerogative.

-- Mar 9 In-Class Exercise
Resource Description for Screen Shot 2022-03-09 at 8.35.59 PM.png
The prime-minister is the head of government for Canada, chairs and selects the membership of the Cabinet, and advises the Crown on the exercise of executive-power and much of the royal prerogative.
Array (
    [0] => The
    [1] => prime-minist
    [2] => is
    [3] => the
    [4] => head
    [5] => of
    [6] => govern
    [7] => for
    [8] => Canada,
    [9] => chair
    [10] => and
    [11] => select
    [12] => the
    [13] => membership
    [14] => of
    [15] => the
    [16] => Cabinet,
    [17] => and
    [18] => advis
    [19] => the
    [20] => Crown
    [21] => on
    [22] => the
    [23] => exercis
    [24] => of
    [25] => executive-power
    [26] => and
    [27] => much
    [28] => of
    [29] => the
    [30] => royal
    [31] => prerogative.
)
(Edited: 2022-03-09)
((resource:Screen Shot 2022-03-09 at 8.35.59 PM.png|Resource Description for Screen Shot 2022-03-09 at 8.35.59 PM.png)) The prime-minister is the head of government for Canada, chairs and selects the membership of the Cabinet, and advises the Crown on the exercise of executive-power and much of the royal prerogative. Array ( [0] => The [1] => prime-minist [2] => is [3] => the [4] => head [5] => of [6] => govern [7] => for [8] => Canada, [9] => chair [10] => and [11] => select [12] => the [13] => membership [14] => of [15] => the [16] => Cabinet, [17] => and [18] => advis [19] => the [20] => Crown [21] => on [22] => the [23] => exercis [24] => of [25] => executive-power [26] => and [27] => much [28] => of [29] => the [30] => royal [31] => prerogative. )

-- Mar 9 In-Class Exercise
Resource Description for Screenshot 2022-03-09 at 9.00.59 PM.png Resource Description for Screenshot 2022-03-09 at 9.00.33 PM.png
((resource:Screenshot 2022-03-09 at 9.00.59 PM.png|Resource Description for Screenshot 2022-03-09 at 9.00.59 PM.png)) ((resource:Screenshot 2022-03-09 at 9.00.33 PM.png|Resource Description for Screenshot 2022-03-09 at 9.00.33 PM.png))

-- Mar 9 In-Class Exercise
<?php namespace divyashree\test;
use seekquarry\yioop\library\PhraseParser;
require_once "vendor/autoload.php";
$strin ="The prime minister is the head of government for Canada, chairs and selects the membership of the Cabinet, and advises the Crown on the exercise of executive power and much of the royal prerogative. ";
PhraseParser::hyphenateEntities($strin,'en-US'); echo $strin;
$stemterms = PhraseParser::stemTerms($strin,'en-US');
var_dump($stemterms);
<?php namespace divyashree\test; use seekquarry\yioop\library\PhraseParser; require_once "vendor/autoload.php"; $strin ="The prime minister is the head of government for Canada, chairs and selects the membership of the Cabinet, and advises the Crown on the exercise of executive power and much of the royal prerogative. "; PhraseParser::hyphenateEntities($strin,'en-US'); echo $strin; $stemterms = PhraseParser::stemTerms($strin,'en-US'); var_dump($stemterms);

-- Mar 9 In-Class Exercise
Code:
<?php
namespace gargi\test_composer; 
 
use seekquarry\yioop\configs as SYC;
use seekquarry\yioop\library as SYL;
use seekquarry\yioop\library\Library;
use seekquarry\yioop\library\PhraseParser; 
 
require_once "vendor/autoload.php";
/*
   Since a normal Yioop instance needs a Profile.php file to be generated,
   the following is used to set up Yioop in library mode so you don't need this.
   To enable debugging use Library::init(true);
 */
Library::init();
$inputstr = "The prime minister is the head of government for Canada, chairs and selects the membership of the Cabinet, and advises the Crown on the exercise of executive power and much of the royal prerogative. ";
PhraseParser::hyphenateEntities($inputstr, "en-US");
echo $inputstr; 
 
Output:
Hyphenated: The prime-minister is the head of government for Canada, chairs and selects the membership of the Cabinet, and advises the Crown on the exercise of executive-power and much of the royal prerogative.
Stemmed: array(32) {
  [0]=>
  string(3) "The"
  [1]=>
  string(12) "prime-minist"
  [2]=>
  string(2) "is"
  [3]=>
  string(3) "the"
  [4]=>
  string(4) "head"
  [5]=>
  string(2) "of"
  [6]=>
  string(6) "govern"
  [7]=>
  string(3) "for"
  [8]=>
  string(7) "Canada,"
  [9]=>
  string(5) "chair"
  [10]=>
  string(3) "and"
  [11]=>
  string(6) "select"
  [12]=>
  string(3) "the"
  [13]=>
  string(10) "membership"
  [14]=>
  string(2) "of"
  [15]=>
  string(3) "the"
  [16]=>
  string(8) "Cabinet,"
  [17]=>
  string(3) "and"
  [18]=>
  string(5) "advis"
  [19]=>
  string(3) "the"
  [20]=>
  string(5) "Crown"
  [21]=>
  string(2) "on"
  [22]=>
  string(3) "the"
  [23]=>
  string(7) "exercis"
  [24]=>
  string(2) "of"
  [25]=>
  string(15) "executive-power"
  [26]=>
  string(3) "and"
  [27]=>
  string(4) "much"
  [28]=>
  string(2) "of"
  [29]=>
  string(3) "the"
  [30]=>
  string(5) "royal"
  [31]=>
  string(12) "prerogative."
}
<pre> Code: <?php namespace gargi\test_composer; use seekquarry\yioop\configs as SYC; use seekquarry\yioop\library as SYL; use seekquarry\yioop\library\Library; use seekquarry\yioop\library\PhraseParser; require_once "vendor/autoload.php"; /* Since a normal Yioop instance needs a Profile.php file to be generated, the following is used to set up Yioop in library mode so you don't need this. To enable debugging use Library::init(true); */ Library::init(); $inputstr = "The prime minister is the head of government for Canada, chairs and selects the membership of the Cabinet, and advises the Crown on the exercise of executive power and much of the royal prerogative. "; PhraseParser::hyphenateEntities($inputstr, "en-US"); echo $inputstr; Output: Hyphenated: The prime-minister is the head of government for Canada, chairs and selects the membership of the Cabinet, and advises the Crown on the exercise of executive-power and much of the royal prerogative. Stemmed: array(32) { [0]=> string(3) "The" [1]=> string(12) "prime-minist" [2]=> string(2) "is" [3]=> string(3) "the" [4]=> string(4) "head" [5]=> string(2) "of" [6]=> string(6) "govern" [7]=> string(3) "for" [8]=> string(7) "Canada," [9]=> string(5) "chair" [10]=> string(3) "and" [11]=> string(6) "select" [12]=> string(3) "the" [13]=> string(10) "membership" [14]=> string(2) "of" [15]=> string(3) "the" [16]=> string(8) "Cabinet," [17]=> string(3) "and" [18]=> string(5) "advis" [19]=> string(3) "the" [20]=> string(5) "Crown" [21]=> string(2) "on" [22]=> string(3) "the" [23]=> string(7) "exercis" [24]=> string(2) "of" [25]=> string(15) "executive-power" [26]=> string(3) "and" [27]=> string(4) "much" [28]=> string(2) "of" [29]=> string(3) "the" [30]=> string(5) "royal" [31]=> string(12) "prerogative." } </pre>
[ Next ]
X