Skip to content

Instantly share code, notes, and snippets.

@leizongmin
Created December 13, 2018 07:52
Show Gist options
  • Save leizongmin/7f0aedde13afeb800813ff4e1e60ed91 to your computer and use it in GitHub Desktop.
Save leizongmin/7f0aedde13afeb800813ff4e1e60ed91 to your computer and use it in GitHub Desktop.
价值一百个亿的 AI 核心代码
// 价值一百个亿的 AI 核心代码
// Do What The Fuck You Want To Public License
open System
let replace (oldstr : string) (newstr : string) (text : string) =
text.Replace(oldstr, newstr)
let ask() =
Console.Write("> ")
Console.ReadLine()
let answer text =
text
|> replace "吗" ""
|> replace "?" "!"
|> replace "?" "!"
[ "在吗?"; "你好"; "能听懂汉语吗?"; "真的吗?" ]
|> List.iter (fun question ->
Console.WriteLine("> " + question)
Console.WriteLine(" " + answer question))
let mutable loop = true
while loop do
let question = ask()
if question.Length < 1 then loop <- false
else Console.WriteLine(" " + answer question)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment