Created
December 13, 2018 07:52
-
-
Save leizongmin/7f0aedde13afeb800813ff4e1e60ed91 to your computer and use it in GitHub Desktop.
价值一百个亿的 AI 核心代码
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 价值一百个亿的 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