我想写一个代码删除,如“了”,“这个”,在一个字符串列表等停用词去除F#
我写了这个代码停用词:
let rec public stopword (a : string list, b :string list) =
match [a.Head] with
|["the"]|["this"] -> stopword (a.Tail, b)
|[] -> b
|_ -> stopword (a.Tail, [email protected][a.Head])
我跑这在互动:
stopword (["this";"is";"the"], []);;
我得到这个错误:
This expression was expected to have type string list but here has type 'a * 'b
万分感谢!!!!!!这个很有效。我希望我能在几个月内写下这段代码:) – codious 2012-02-23 09:31:14