https://github.com/longbridge/tinyml
Longbridge Plain Text format.
https://github.com/longbridge/tinyml
ast parser text-processor tokenizer
Last synced: about 1 year ago
JSON representation
Longbridge Plain Text format.
- Host: GitHub
- URL: https://github.com/longbridge/tinyml
- Owner: longbridge
- Created: 2020-07-20T07:33:17.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2022-02-23T13:03:18.000Z (about 4 years ago)
- Last Synced: 2025-01-10T04:13:07.887Z (about 1 year ago)
- Topics: ast, parser, text-processor, tokenizer
- Language: Go
- Homepage:
- Size: 17.6 KB
- Stars: 0
- Watchers: 8
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# TinyML
LongBridge Plain Text format.
[](https://travis-ci.org/long-bridge/tinyml)
## Usage
```go
package main
import (
"fmt"
"github.com/longbridgeapp/tinyml"
)
func main() {
out, _ := tinyml.ToText("消息称[st]ST/US/BABA#阿里巴巴.US[/st]将于5月,在港股上市。")
fmt.Println(out)
// 消息称 阿里巴巴.US 将于 5 月,在港股上市。
out, _ = tinyml.ToHTML("消息称[st]ST/US/BABA#阿里巴巴.US[/st]将于5月,在港股上市。\n\n几家领头羊都处于第一步或者第二步。")
fmt.Println(out)
//
消息称 阿里巴巴.US 将于 5 月,在港股上市。
几家领头羊都处于第一步或者第二步。
}
```
Example:
https://play.golang.org/p/vNGesNpEQzx
## Benchmark
Run `go test -bench=.` to benchmark.
```bash
BenchmarkToHTML-12 19084 62621 ns/op
BenchmarkToText-12 41409 28675 ns/op
```