我想在命令行中實現siri/cortana類似功能的一個小子集。如何在命令行中實現Siri/Cortana類似的功能?
例如,
$ What is the sum of 100 and 1000
> Response: 1100
$ What is the product of 10 and 12
> Response: 120
這些問題是預定義的正則表達式。它需要在ruby中調用匹配函數。 模式:什麼是(\ d)+和(\ d)+ Ruby方法調用:sum(a,b)
任何指針/建議表示讚賞。