Skip to content

Commit

Permalink
Remove token based isVerb
Browse files Browse the repository at this point in the history
  • Loading branch information
ekinhbayar committed Nov 28, 2016
1 parent d1c8787 commit 053d57c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 17 deletions.
20 changes: 4 additions & 16 deletions src/BrillTagger.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,17 +105,6 @@ public function isVerb($tag) {
return substr(trim($tag), 0, 2) == 'VB' || $this->isVerbToHave($tag);
}

/**
* @param string $tag
* @param string $token
* @return bool
*/
public function isTokenVerb($tag, $token) {
return substr(trim($tag), 0, 2) == 'VB'
|| $this->isVerbToHave($tag)
|| in_array('VB', $this->dictionary[strtolower($token)]);
}

/**
* @param string $tag
* @return bool
Expand Down Expand Up @@ -326,18 +315,17 @@ public function transformVerbsToThirdPerson($tag, $token) {
$verbs = ['can', 'shall', 'am', 'was', 'were', 'haz', 'said', 'made', 'do', 'go'];
$isVB = $this->isVerb($tag) || in_array($token, $verbs);
# Disregard verb tags that don't need s|es|ies
$isOK = in_array($tag, [ 'VBD', 'VBG', 'VBN', 'VBZ', 'MD' ]);
$isOK = in_array($tag, [ 'VBD', 'VBG', 'VBN', 'VBZ', 'MD' ]);

if ($isVB) {
if (substr($token, -1 ) == 'o') {
$o = "{$token}es";
$o = $token . 'es';
} elseif (substr($token, -1 ) == 'y') {
$token = substr($token, 0, 2);
$o = "{$token}ies";
$o = substr($token, 0, 2) . 'ies';
} elseif ($isOK) {
$o = $token;
} else {
$o = "{$token}s";
$o = $token . 's';
}

return $o;
Expand Down
1 change: 0 additions & 1 deletion tests/BrillTaggerTests/BrillTaggerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,6 @@ public function testIsPossessivePronoun(string $input, array $expected)
*/
public function testVerbTransformationThirdPerson(string $input, string $expected) {
$tags = $this->tagger->tag($input);
var_dump($tags);
$this->assertSame($expected, $this->tagger->transformVerbsToThirdPerson($tags[0]['tag'], $tags[0]['token']));
}

Expand Down

0 comments on commit 053d57c

Please sign in to comment.