Skip to content

Commit

Permalink
Fix undefined case
Browse files Browse the repository at this point in the history
  • Loading branch information
ekinhbayar committed Dec 3, 2016
1 parent 053d57c commit fc16174
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/BrillTagger.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ public function tag($text) {
}

# get from dictionary if set
if ($this->tokenExists($token)) {
$tags[$i]['tag'] = $this->dictionary[strtolower($token)][0];
}
$tags[$i]['tag'] = $this->tokenExists($token)
? $this->dictionary[strtolower($token)][0]
: 'NN';

$tags[$i]['tag'] = $this->transformNumerics($tags[$i]['tag'], $token);

Expand Down Expand Up @@ -190,7 +190,9 @@ public function isPossessivePronoun($tag) {
* @return bool
*/
public function isAdjective($token) {
return (substr($token, -2) == 'al' || in_array('JJ', $this->dictionary[strtolower($token)]));
return ($this->tokenExists($token))
? in_array('JJ', $this->dictionary[strtolower($token)])
: substr($token, -2) == 'al';
}

/**
Expand Down

0 comments on commit fc16174

Please sign in to comment.