Tokenize the term. Returns an array with the tokens.

@param string $term
@return array
@throws Exceptions\ContainerException
@throws Exceptions\NotFoundException
168003
public function tokenize($term)
    {
        $stringHelper = $this->container->get('stringcalc_stringhelper');
        $stringHelper->validate($term);
        $term = strtolower($term);

        /** @var InputStreamInterface $inputStream */
        $inputStream = $this->container->get('stringcalc_inputstream');
        $inputStream->setInput($term);

        /** @var StringHelperInterface $stringHelper */
        $stringHelper = $this->container->get('stringcalc_stringhelper');

        $tokenizer = new Tokenizer($inputStream, $stringHelper);

        $tokens = $tokenizer->tokenize();

        return $tokens;
    }
619390
public function createTerm(string $term, string $taxonomy, array $args = []): array
    {
        $args['taxonomy'] = $taxonomy;
        $args['term'] = $term;

        $term = $this->getDriver()->term->create($args);

        return array(
            'id'   => $term->term_id,
            'slug' => $term->slug
        );
    }
1297142
public function getByTerm($year, $term)
    {
        $url = Config::get('url.exam_basic');

        $param['__VIEWSTATE'] = true;
        $param['__EVENTTARGET'] = "xnd";
        $param['__EVENTARGUMENT'] = "";
        $param['xnd'] = $year;
        $param['xqd'] = $term;

        $response = $this->request('post', [$url, $param]);

        return $this->parseExam($response);
    }
419364
def map_tokens_to_terms(self,list_tokens):
        
        if self.terms_for_token is None:
            self.terms_for_token = {}
            for term in self.get_terms():
                termid = term.get_id()
                token_ids = term.get_span().get_span_ids()
                for tokid in token_ids:
                    if tokid not in self.terms_for_token:
                        self.terms_for_token[tokid] = [termid]
                    else:
                        self.terms_for_token[tokid].append(termid)

        ret = set()
        for my_id in list_tokens:
            term_ids = self.terms_for_token.get(my_id,[])
            ret |= set(term_ids)
        return sorted(list(ret))
1169048
public function tokenize($input) : iterable
    {
        if (!is_string($input)) {
            throw new core\exceptions\InvalidArgumentType($input, ['string']);
        }

        // Change line breaks, tabs etc. into whitespaces.
        $length = strlen($input);
        $cursor = 0;
        $i      = 0;
        $tokens = new formats\tokens\Argv;

        while ($cursor < $length) {
            if (preg_match('/\s+/A', $input, $match, null, $cursor)) {
            } elseif (preg_match('/([^="\'\s]+?)(=?)('.static::PATTERN_QUOTED.'+)/A', $input, $match, null, $cursor)) {
                $tokens->set($i++, $match[1].$match[2].stripcslashes(str_replace(['"\'', '\'"', '\'\'', '""'], '', substr($match[3], 1, -1))));
            } elseif (preg_match('/'.static::PATTERN_QUOTED.'/A', $input, $match, null, $cursor)) {
                $tokens->set($i++, stripcslashes(substr($match[0], 1, -1)));
            } elseif (preg_match('/'.static::PATTERN_BARE.'/A', $input, $match, null, $cursor)) {
                $tokens->set($i++, stripcslashes($match[1]));
            } else {
                throw new \RuntimeException('Failed to parse string near "... '.substr($input, $cursor, 10).' ..."');
            }

            $cursor += strlen($match[0]);
        }

        return $tokens;
    }
1308814
public function tokenize($string)
    {
        if(!$this->length) {
            return array(substr($string, $this->startPosition));
        } else {
            return array(substr($string, $this->startPosition, $this->length));
        }
    }
430618
public function search($term)
    {
        $url = $this->baseUrl.'/search.php?search='.urlencode($term).'&Submit=Search';

        $parser = $this->parse($url);

        $data = new \stdClass();

        $parser->filter('span.titulo a')->each(function (Crawler $node) use ($data) {
            $data->showUrl = $this->baseUrl.'/'.$node->attr('href');
            $data->showId = substr($node->attr('href'), strrpos($node->attr('href'), '/')+1);
        });

        $data->results = array();

        // Parse all results page
        $parser->filter('table.tabel a')->each(function (Crawler $node) use ($data) {
            $result = new \stdClass();
            $result->title = $node->text();
            $result->url = $this->baseUrl.'/'.$node->attr('href');
            $data->results[] = $result;
        });

        // If show id not found, find an otherway to get it!
        if(!isset($data->showUrl) && count($data->results) > 0) {
            // Query as results, now find the show id
            $result = $data->results[0];

            $parser = $this->parse($result->url);

            $showIds = $parser->filter('table.tabel70 a')->each(function (Crawler $node) use ($data) {
                $href = $node->attr('href');
                if(substr($href, 0, 6) == '/show/') {
                    $showId = substr($href, 6);
                    if(is_numeric($showId)) {
                        return $showId;
                    }
                }
            });

            // Remove NULL values
            $showIds = array_filter($showIds);

            // Take the first id
            foreach($showIds as $showId) {
                if(is_numeric($showId)) {
                    $data->showId = $showId;
                    $data->showUrl = $this->baseUrl.'/show/'.$showId;
                    break;
                }
            }
        }

        return $data;
    }
800112
public static function ToTitlecase($term) {
      return strtoupper(substr($term, 0, 1)) . strtolower(substr($term, 1, strlen($term)));
    }
480110
public function addDefinition(string $term, $description){
        $this->list[]   = [
            "term"          => $term,
            "description"   => array_filter(
                (array)$description,
                function($v){
                    return is_scalar($v)
                        || (is_object($v) && method_exists($v, "__toString"));
                }
            ),
        ];

        return $this;
    }
682386
public function makeSearch($term)
    {
        // check if user has permissions to access this link
        if(!User::hasAccess('User', 'read')) {
            return $this->noPermission();
        }

        $orderBy = (isset($_GET['order'])) ? $orderBy = $_GET['order'] : 'userID';
        $orderType = (isset($_GET['type'])) ? $orderType = $_GET['type'] : 'DESC';

        // join parameters for the query
        // we are left joinin the the media table
        $joins = array(
          [
            'table' => 'media',
            'type' => 'left',
            'whereTable1' => "profileImageID",
            'whereTable2' => "mediaID",
          ]
        );

        $excludeColumns = array('remember_token', 'created_at', 'updated_at');
        return Search::searchByTerm('users', $term, 1, true, array(), $excludeColumns, $orderBy, $orderType, $joins);
    }
1195045
public static function create($term, $taxonomy = null)
    {
        // Ex: Taco\Term\Factory::create('Keyword')
        if (is_string($term) && class_exists($term)) {
            return new $term;
        }

        if (!is_object($term)) {
            $term = get_term($term, $taxonomy);
        }
        
        // TODO Refactor how this works to be more explicit and less guess
        $class = str_replace(' ', '', ucwords(str_replace(Base::SEPARATOR, ' ', $term->taxonomy)));
        if (!class_exists($class)) {
            $class = str_replace(' ', '\\', ucwords(str_replace(Base::SEPARATOR, ' ', $term->taxonomy)));
        }

        $instance = new $class;
        $instance->load($term->term_id);
        return $instance;
    }
906084
protected function prepare_links( $term ) {
		$base = $this->namespace . '/' . $this->rest_base;
		$links = array(
			'self'       => array(
				'href' => rest_url( trailingslashit( $base ) . $term->term_id ),
			),
			'collection' => array(
				'href' => rest_url( $base ),
			),
			'about'      => array(
				'href' => rest_url( sprintf( 'wp/v2/taxonomies/%s', $this->taxonomy ) ),
			),
		);

		if ( $term->parent ) {
			$parent_term = get_term( (int) $term->parent, $term->taxonomy );
			if ( $parent_term ) {
				$links['up'] = array(
					'href'       => rest_url( trailingslashit( $base ) . $parent_term->term_id ),
					'embeddable' => true,
				);
			}
		}

		$taxonomy_obj = get_taxonomy( $term->taxonomy );
		if ( empty( $taxonomy_obj->object_type ) ) {
			return $links;
		}

		$post_type_links = array();
		foreach ( $taxonomy_obj->object_type as $type ) {
			$post_type_object = get_post_type_object( $type );
			if ( empty( $post_type_object->show_in_rest ) ) {
				continue;
			}
			$rest_base = ! empty( $post_type_object->rest_base ) ? $post_type_object->rest_base : $post_type_object->name;
			$post_type_links[] = array(
				'href' => add_query_arg( $this->rest_base, $term->term_id, rest_url( sprintf( 'wp/v2/%s', $rest_base ) ) ),
			);
		}
		if ( ! empty( $post_type_links ) ) {
			$links['https://api.w.org/post_type'] = $post_type_links;
		}

		return $links;
	}
312841
protected function singularize($word)
    {
        $result = strval($word);

        if (in_array(strtolower($result), $this->uncountableWords())) {
            return $result;
        } else {
            foreach ($this->singularRules() as $rule => $replacement) {
                if (preg_match($rule, $result)) {
                    $result = preg_replace($rule, $replacement, $result);
                    break;
                }
            }

            return $result;
        }
    }
441710
public function search($term)
    {
        $query = $this->model->orderBy('created_at', 'desc');
        $query->where('id', 'LIKE', '%'.$input['term'].'%');

        $columns = Schema::getColumnListing(str_plural($this->modelName));

        foreach ($columns as $attribute) {
            $query->orWhere($attribute, 'LIKE', '%'.$input['term'].'%');
        }

        return [
            'term' => $input['term'],
            'result' => $query->paginate(Config::get('cms.pagination', 24)),
        ];
    }
740985
public function tokenize($filename) {
		$this->tokens = array();

		// Read the file
		if (filesize($filename)) {
			$fp = fopen($filename, "rb");
			$this->content = fread($fp, filesize($filename));
			$this->tokens = $this->_getAllTokens($this->content);
			fclose($fp);
		}
	}
258642
protected function fullTextWildcards($term)
    {
        // removing symbols used by MySQL
        $reservedSymbols = ['-', '+', '<', '>', '@', '(', ')', '~'];
        $term = str_replace($reservedSymbols, '', $term);

        $words = explode(' ', $term);

        foreach ($words as $key => $word) {
            /*
             * applying + operator (required word) only big words
             * because smaller ones are not indexed by mysql
             */
            if (strlen($word) >= 3) {
                // $words[$key] = '+' . $word . '*';
                $words[$key] = $word.'*';
            }
        }

        $searchTerm = implode(' ', $words);

        return $searchTerm;
    }
1135656
private function tokenizeKey($key)
    {
        $containerName = $this->containerName;
        if (false === $this->multiContainerMode) {
            return [$containerName, $key];
        }

        if (false === ($index = strpos($key, '/'))) {
            throw new \InvalidArgumentException(sprintf(
                'Failed to establish container name from key "%s", container name is required in multi-container mode',
                $key
            ));
        }
        $containerName = substr($key, 0, $index);
        $key = substr($key, $index + 1);

        return [$containerName, $key];
    }