< 返回版块

洋芋 发表于 2021-02-13 21:19

Tags:rust, 日报

Rust牛年春晚节目单

Rust牛年春晚,明天牛年初三,下午4点-12点。

节目单

calc,一个命令行计算器

calc,一个Rust 实现的命令行计算器。

Github 链接,https://github.com/coriolinus/calc

表达式模式

$ calc "1/(2+(3*(4-5)))"
-1
$ calc "round(12345 / 543)"
23

Shell 模式

$ calc
[0]: 1 + 1
2
[1]: 3*(5/(3-4))
-15
[2]: 3*pi**2
29.608813203268074
[3]: @+1
30.608813203268074
[4]: @@@*2
-30
[5]: ln(-1)
NaN

nlprule,Rust 实现的 NLP 库

nlprule 使用 LanguageTool 中的资源为NLP实现了基于规则和查找的方法。

Github链接,https://github.com/bminixhofer/nlprule

from nlprule import Tokenizer, Rules

tokenizer = Tokenizer.load("en")
rules = Rules.load("en", tokenizer)

rules.correct("He wants that you send him an email.")
# returns: 'He wants you to send him an email.'

rules.correct("I can due his homework.")
# returns: 'I can do his homework.'

for s in rules.suggest("She was not been here since Monday."):
    print(s.start, s.end, s.replacements, s.source, s.message)
# prints:
# 4 16 ['was not', 'has not been'] WAS_BEEN.1 Did you mean was not or has not been?

for sentence in tokenizer.pipe("A brief example is shown."):
    for token in sentence:
        print(
            repr(token.text).ljust(10),
            repr(token.span).ljust(10),
            repr(token.tags).ljust(24),
            repr(token.lemmas).ljust(24),
            repr(token.chunks).ljust(24),
        )
# prints:
# ''         (0, 0)     ['SENT_START']           []                       []                      
# 'A'        (0, 1)     ['DT']                   ['A', 'a']               ['B-NP-singular']       
# 'brief'    (2, 7)     ['JJ']                   ['brief']                ['I-NP-singular']       
# 'example'  (8, 15)    ['NN:UN']                ['example']              ['E-NP-singular']       
# 'is'       (16, 18)   ['VBZ']                  ['be', 'is']             ['B-VP']                
# 'shown'    (19, 24)   ['VBN']                  ['show', 'shown']        ['I-VP']                
# '.'        (24, 25)   ['.', 'PCT', 'SENT_END'] ['.']                    ['O']

# and every call here takes less than 1ms! (on an i5 8600k)

Fly.io 升级Tokio到1.x

Fly.io 基于Rust 的 Tokio 和 Hyper 实现负载均衡,Tokio 升级到 v1.x,Fly.io 将其使用的 Tokio 从 v0.2 升级到 v1.x,并认为虽然是一个主要版本的升级,但升级过程并不难。

这篇博客文章记录了一些笔记,文章链接,https://fly.io/blog/the-tokio-1-x-upgrade/

PyO3 为 Rust 1.41 提供支持

在 Debian Buster,Alpine 3.12 和其他使用较旧 Rust 编译器版本 v1.41 的平台,PyO3 不能与Rust v1.41一起编译,目前已提供支持 Rust v1.41。

Github issue 链接,https://github.com/PyO3/pyo3/issues/1420


From 日报小组 洋芋

社区学习交流平台订阅:

评论区

写评论
E834159672 2021-02-14 10:53

Rust 节目单 图片:

https://imglf3.lf127.net/img/OWhVb1F5ZzAwVWxwc0NWaHlHMzdvb1I1M2VKeGVyOFlsdll1ZlJTVWEvSjlOSGlrTHBMODBRPT0.png?imageView&thumbnail=1680x0&quality=96&stripmeta=0

1 共 1 条评论, 1 页