src/TextParser.php
public function parseText($text, $findMatchingTemplate = false)
    {
        $this->logger->info(sprintf('Parsing: %s', $text));

        $text = $this->prepareText($text);
        $matchedTemplates = $this->getTemplates($text, $findMatchingTemplate);

        foreach ($matchedTemplates as $templatePath => $templateContent) {
            $this->logger->debug(sprintf('Parsing against template: %s', $templatePath));

            $templatePattern = $this->prepareTemplate($templateContent);
            $extractedData = $this->extractData($text, $templatePattern);

            if ($extractedData) {
                $this->logger->info(sprintf('Data extracted: %s', json_encode($extractedData)));

                return $extractedData;
            }
        }

        return null;
    }
public function parseText($text, $findMatchingTemplate = false)
    {
        $this->logger->info(sprintf('Parsing: %s', $text));

        $text = $this->prepareText($text);
        $matchedTemplates = $this->getTemplates($text, $findMatchingTemplate);

        foreach ($matchedTemplates as $templatePath => $templateContent) {
            $this->logger->debug(sprintf('Parsing against template: %s', $templatePath));

            $templatePattern = $this->prepareTemplate($templateContent);
            $extractedData = $this->extractData($text, $templatePattern);

            if ($extractedData) {
                $this->logger->info(sprintf('Data extracted: %s', json_encode($extractedData)));

                return $extractedData;
            }
        }

        return null;
    }
The call for action method, this is the parse job initiator

@param string $text ; The text provided by the user for parsing
@param boolean $findMatchingTemplate ; A boolean to enable the similarity match against templates before parsing (slower)
@return array The matched data array or null on unmatched text