F#: Link actual word/definitions dictionary to code - f#

I'm running into a search issue with my question. I'm trying to link an actual dictionary (e.g., words with definitions) to some code I'm writing in F#. Specifically, I'm using FsVerbalExpressions to identify whitespace-separated strings and would like to look each string up in an actual dictionary to determine if they're words or not.
The problem I'm having is that when I search on SO (or Google or anywhere else) for "link dictionary to F#" or "F# dictionary library" or some other permutation of "F#" and "dictionary," I get hits on how to use the dictionary collection in F#.
I'm hoping someone out there has some insight into how to link a dictionary, though this answer has given me some directions to alternatives if I can't find exactly what I'm trying to do.
Thanks for your help!

Related

seaching 2D ArrayLib does not work for some cases

I have 2D array in which the second column has domain names of some emails, let us call the array myData[][]. I decided to use ArrayLib in order to search the second column for a specific domain.
ArrayLib.indexOf(myData, 1, domain)
Here is where I found an issue. In myData array, one of the domains look like this "ewmining.com" (pay attention to the w).
While searching for "e.mining.com" (notice the first dot), the indexOf() function actully gave me the row containing "ewmining.com".
This is what is in the array "ewmining.com"
This is what is in the serach string "e.mining.com"
It seams that ArrayLib treats the dot to mean any character. Is this supposed to be the correct behavior? Is there a way to stop this behavior and search for exact match.
I really need help on this issue.
Thanks in advance for your help.
The dot usually represents "any character" in regular expressions. I am not familiar with ArrayLib, but maybe you should look for a way to turn off regular expressions when searching. Otherwise you might have to escape the dot, for example search for e[.]mining[.]com

haskell parsing data structure with extra information

I have problem to extract extra information from my parsing.
I have my own data structure to parse, and that works fine. I wrote the parser for my data structure as Parse MyDataStructure which parse all the information about MyDataStructure.
The problem is that in the string I'm parsing, mixed with MyDataStructure, there is also some information about what should I do with MyDataStructure which is of course not part of MyDataStructure, i.e. I cannot store this information inside MyDataStructure.
Now the problem is that I don't know how to store this information, since in Haskell I cannot change some global variable to store information, and the return value of my parser is already MyDataStructure.
Is there a way I can somehow store this new information, without changing MyDataStructure, i.e. including field to store the extra information (but the extra information are not part of MyDataStructure so I would really like avoiding doing that)?
I hope I have been clear enough.
As #9000 says, you could use a tuple. If you find yourself needing to pass it through a number of functions, using the State Monad might make things easier.

F# equivalent of SortedDictionary from C#

new to F#
i need to store a bunch of lists of objects according to a float number where the collection of lists are sorted according to the float number. I know in C# i would use
SortedDictionary<float, List<obj>>
as the implementation is a red black tree, allowing for log(n) insert and search. But whats the best way to attack the situation in F#. I attempted to use SortedDitionary but i can't refer to SortedDictionary[int] to find the value so it renders it as useless essentially (i could be doing it wrong).
thanks for the help
The syntax is
sorteddictionary.[int]
then it works as you would expect
The first thig to do is read Okasaki's book Purely Functional Data Structures
It has ML implementations that may help you
You can use sorteddictionary.[int] as John Palmer already said but it may be worth pointing out that the F# standard library includes a purely functional sorted dictionary collection called Map.

UITextChecker is what dictionary?

Does anybody know what dictionary UITextChecker pulls from? I use it to verify that a word is in fact a valid word in an app. I have some questions from users about why specific words are available in other games (Boggle/Scrabble) but not in mine.
Examples: ai, qi, qat, xu, ae, tae, ait, ain, lav, aa, shh, za
I checked against /usr/share/dict/words and none of these words are in Websters Second International, so maybe UITextChecker uses this same source? They do show up in other dictionaries online (but this is really besides the point of the post).
Thanks for any insight!
UITextChecker may be using the same dictionary that UIReferenceLibraryViewController uses. In which case, you could use something like [UIReferenceLibraryViewController dictionaryHasDefinitionForTerm: #"term"] and if it returns true the word exists. I'm not sure how complete the built in dictionary is however.
I guess it uses the iPhone dictionary of the user, which depends on the current language/NSLocale the user is using (which is set in the "International" Settings on the iPhone). This is the behavior we observe when typing some text anywhere in the iPhone, words underlined in read (because detected by the internal UITextChecker) depends on the locale used.
If the user have activated multiple keyboards with different languages each (e.g. a French AZERTY keyboard and an US QWERTY keyboard) it depends obviously on the current language, namely the current keyboard active at this moment.
If you refer to the wordfeud dictionary... (that would be the only game I know those words from). They check their words from an online dictionary on their own server. Must be a list parsed from another spelling site or something.
I sometimes doubt the validity of some words though....

What's the format of the OpenOffice dictionaries?

Does anyone know what the format of the OpenOffice dictionary files are? As far as I can see there is one word per line, and some flags that presumably tells me something about the word.
Here's a couple of lines from the english dictionary as an example:
absoluteness/S
absorbency/SM
abstract/ShTVDPiGY
absurdness/S
And from the Norwegian dictionary, which is what I'll use:
flatorm/AEG
flatpresse/W
flatseng/ACEG
flatside/ACDEFGHJ
flatskjerm/A
What does for instance "/AEG" and "/S" mean? I assume each letter/flag has a certain meaning, so that tha A in "/AEG" means the same as the A in "/ACDEFGHJ".
I have googled all over the place, but I can't find any information.
OO uses the hunspell engine for spell-checking. The stuff after the "/" is linked to data in the corresponding affix file.

Resources