我正在为命名实体识别标记文本数据集。考虑以下示例:
{team:Alfreton Town} manager {manager:Nicky Law} says his players deserve huge credit for the character they have shown in their {league:Blue Square Bet Premier} relegation fight.
Run Code Online (Sandbox Code Playgroud)
我必须找到各种类型的所有实体,并将它们添加到类别前缀和后缀中。我想做的是预定义几个快捷方式,例如:
Meta + T将选定的文本替换$s为{team:$s}Meta + P将选定的文本替换$s为{player:$s}我对 VScode 扩展不是很熟悉。是否有一些插件可以允许定义此类替换?
我正在尝试实现一个将字符串转换为Maybe Ints列表的函数,例如readInts "1 2 42 foo" = [Just 1,Just 2,Just 42,Nothing].
我的第一个方法是:
readInts (s::String) = do {
ws <- words s;
return (map (readMaybe::(String -> Maybe Int)) ws)
}
Run Code Online (Sandbox Code Playgroud)
这导致以下错误:
lab_monad.hs:20:52:
Couldn't match type ‘Char’ with ‘[Char]’
Expected type: [String]
Actual type: String
In the second argument of ‘map’, namely ‘ws’
In the first argument of ‘return’, namely
‘(map (readMaybe :: String -> Maybe Int) ws)’
Failed, modules loaded: none.
Run Code Online (Sandbox Code Playgroud)
我接下来(和工作)尝试的是:
readInts (s::String) = do {
let ws …Run Code Online (Sandbox Code Playgroud)