Git Product home page Git Product logo

bullshit-generator-js-mondaylab's Introduction

狗屁不通文章生成器

材料backup

原版仓库:https://github.com/akira-cn/bullshit-generator-js

juejin小册:从前端到全栈

本仓库沉淀内容文章生成器 → 1-11节

代码结构

.
├── browser
	  ├── idnex.js 将浏览器要引入的资源统一放在这里加载
├── corpus 存放语料库文件
	  ├── data.json
├── index.js 项目主文件,是一个可以运行的node.js脚本
├── lib 项目依赖的库文件
	  ├── cmd.js 实现带参数的命令行交互
   	  ├── generator.js 用来生成文章内容
       ├── random.js 用来提供随机算法
	  ├── corpus.js 语料库,用来加载和保存文件功能(即loadCorpus和saveCorpus)
	  ├── interact,ts 文章生成器的交互过程
├── build.js 打包发布项目的代码
├── package.json 配置文件
└── output 存放项目输入结果

其他知识点

data.json:

  • famous —— 名人名言
  • bosh —— 废话
  • bosh_before/said/conclude —— 用来修饰和替换famous以及bosh里面的内容

两种读取命令行参数的方式:

  • process.argv
  • command-line-args

两种命令行交互的方式:

  • process.stdin —— process.stdin是异步的,它继承EventEmitter对象,能够派发和监听事件。
  • readline —— node.js为我们提供的一个更好的内置模块,它是专门用来实现可交互命令行的。
  • process.stdout.write —— 可以向终端输出字符,可以理解为和cosole.log一样的效果。区别是 console.log 支持多个参数,且能够格式化字符串并自动输出回车符。也就是说,console.log基本上可以替代process.stdout.write功能且更强大,所以我们就基本上不需要使用process.stdout.write了。不过呢,如果我们不希望输出回车换行到终端,那还是可以使用process.stdout.write的。

bullshit-generator-js-mondaylab's People

Contributors

mondaylab avatar

Watchers

 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.