/**
  * {@inheritdoc}
  */
 public function shouldSplit(Model $model)
 {
     $token = $this->getToken($model->getText(), $model->getPosition());
     if ($token !== '' && filter_var($token, FILTER_VALIDATE_EMAIL)) {
         return false;
     }
     return true;
 }
Example #2
0
 /**
  * {@inheritdoc}
  */
 public function shouldSplit(Model $model)
 {
     $token = $this->getToken($model->getText(), $model->getPosition());
     if ($token !== '' && $this->isValidTld($token)) {
         return false;
     }
     return true;
 }
 /**
  * {@inheritdoc}
  */
 public function shouldSplit(Model $model)
 {
     if ($this->lastResult === null || $this->lastText !== $model->getText()) {
         $this->lastResult = $this->finder->find($model->getText());
         $this->lastText = $model->getText();
     }
     foreach ($this->lastResult as $span) {
         if ($span->containsIndex($model->getPosition())) {
             return false;
         }
     }
     return true;
 }
 /**
  * {@inheritdoc}
  */
 public function shouldSplit(Model $model)
 {
     $text = $model->getText();
     $position = $model->getPosition();
     // detect wether preceding token is an abbreviation
     if ($position != 0) {
         if ($this->abbreviationDictionary->contains(strtolower($this->getPrecedingToken($text, $position)))) {
             return false;
         }
     }
     // detect wether preceding token is part of an abbreviation
     // for example: a.n., e.g., i.e., a.m.v.b.
     if ($position < strlen($text) - 1) {
         $token = $this->getToken($text, $position);
         if ($token !== '' && strpos($token, '.') !== false) {
             if ($this->abbreviationDictionary->contains(strtolower($token))) {
                 return false;
             }
         }
     }
     return true;
 }