mathematicator-core/tokenizer
Composer 安装命令:
composer require mathematicator-core/tokenizer
包简介
Math Tokenizer
README 文档
README
PHP Math Tokenizer
Mathematicator Tokenizer is a simple library for converting string math formulas to a stream of tokens with LaTeX support.
Installation
composer require mathematicator-core/tokenizer
Features
- Convert all your math formulas to a stream of tokens
- Convert user math input to LaTeX
- Render the tokens tree map for debug
Usage
Inject the Tokenizer service via DI
and tokenize your query.
use \Mathematicator\Tokenizer\Tokenizer; $tokenizer = new Tokenizer(/* some dependencies */); // Convert math formula to an array of tokens: $tokens = $tokenizer->tokenize('(5+3)*(2/(7+3))'); // Now you can convert tokens to a more useful format: $objectTokens = $tokenizer->tokensToObject($tokens); var_dump($objectTokens); // Return typed tokens with meta data // Render to LaTeX echo $tokenizer->tokensToLatex($objectTokens); // Render to debug tree (extremely fast): echo $tokenizer->renderTokensTree($objectTokens);
Configuration
The tokenizer uses automatic configuration based on DI. Just use the DI container and the service will be fully available.
Mathematicator Framework tools structure
The biggest advantage is that you can choose which layer best fits your needs and start build on the top of it, immediately, without the need to create everything by yourself. Our tools are tested for bugs and tuned for performance, so you can save a significant amount of your time, money, and effort.
Framework tend to be modular as much as possible, so you should be able to create an extension on each layer and its sublayers.
Mathematicator framework layers ordered from the most concrete one to the most abstract one:
| Search | Modular search engine layer that calls its sublayers and creates user interface. |
| Vizualizator |
Elegant graphic visualizer that can render to
SVG, PNG, JPG and Base64. Extensions: Mandelbrot set generator |
| Calculator |
Modular advance calculations layer.
Extensions: Integral Solver , Statistics |
| Engine | Core logic layer that maintains basic controllers, DAOs, translator, common exceptions, routing etc. |
| Tokenizer | Tokenizer that can convert string (user input / LaTeX) to numbers and operators. |
| Numbers | Fast & secure storage for numbers with arbitrary precision. It supports Human string and LaTeX output and basic conversions. |
Third-party packages:
⚠️ Not guaranteed!
| REST API | Install the whole pack as a REST API service on your server (Docker ready) or access it via public cloud REST API. |
Contribution
Please help to improve this documentation by sending a Pull request.
Tests
All new contributions should have its unit tests in /tests directory.
Before you send a PR, please, check all tests pass.
This package uses Nette Tester. You can run tests via command:
composer test
For benchmarking, we use phpbench. You can run benchmarks this way:
composer global require phpbench/phpbench @dev # only the first time
phpbench run
Before PR, please run complete code check via command:
composer cs:install # only first time composer fix # otherwise pre-commit hook can fail
mathematicator-core/tokenizer 适用场景与选型建议
mathematicator-core/tokenizer 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 5.03k 次下载、GitHub Stars 达 10, 最近一次更新时间为 2019 年 07 月 25 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「math」 「tokenizer」 「mathematicator」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 mathematicator-core/tokenizer 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 mathematicator-core/tokenizer 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 mathematicator-core/tokenizer 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Library emulating the PHP internal reflection using just the tokenized source code.
LaTeX formula to PNG
A program for performing lexical analysis, written in PHP
A simple library for make Lexer and Parsers to build a language
Partition problem for balanced arrays splitting made easy.
Simple, chainable calculation library.
统计信息
- 总下载量: 5.03k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 10
- 点击次数: 21
- 依赖项目数: 6
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-07-25