f# iterating over two arrays, using function from a c# library

Posted by user343550 on Stack Overflow See other posts from Stack Overflow or by user343550
Published on 2010-05-18T00:09:56Z Indexed on 2010/05/18 0:20 UTC
Read the original article Hit count: 451

Filed under:
|
|

I have a list of words and a list of associated part of speech tags. I want to iterate over both, simultaneously (matched index) using each indexed tuple as input to a .NET function. Is this the best way (it works, but doesn't feel natural to me):

let taggingModel = SeqLabeler.loadModel(lthPath + 
                      "models\penn_00_18_split_dict.model");
let lemmatizer = new Lemmatizer(lthPath + "v_n_a.txt")
let input = "the rain in spain falls on the plain"

let words = Preprocessor.tokenizeSentence( input )
let tags = SeqLabeler.tagSentence( taggingModel, words )
let lemmas = Array.map2 (fun x y -> lemmatizer.lookup(x,y)) words tags

© Stack Overflow or respective owner

Related posts about F#

Related posts about array