Giter Club home page Giter Club logo

bnhhsh's Introduction

「不能好好说话」不对劲的拼音首字母缩写翻译工具

大家有用过「能不能好好说话?」 拼音首字母缩写翻译工具吗?

但是它——

./img/s.jpg

所以我发明了「不能好好说话」,它和「能不能好好说话?」的区别是它不能好好说话,只会说色色的话!

原理

其实是直接用动态规划造句啦!

首先我们根据每个词的色度给它定义 1 个痛苦值,越色就越不痛苦。

f(i)表示输入的字符串到第 i 个字符的最小痛苦值,其中f(-1)=0

那么,假如f(i)的末尾的k个字符所组成的子串是词表中某个词的缩写,那么f(i)就可以从f(i-k)转移得到,即:

f(i) = min(f(i-k)+痛苦(k,i))

看来发明输入法还挺简单的嘛!

安装方法

首先你需要 1 个 Node.js 环境,然后——

npm i bnhhsh

就行啦。

使用方法

安装好之后,你就可以——

import dp from 'bnhhsh'
console.log(dp('ynmm'))

输出:

幼女魅魔

幼女魅魔好耶!

结束

我要去和幼女魅魔亲热了,大家 88!

bnhhsh's People

Contributors

okyokuto avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.