Linq or dictionary

Hi, 
   I am pretty new to Linq and I am not quite sure when it is best to use it 
and when other methods might be preferable.
For example, I need to create a list of Sample objects which I then access 
by the SampleName property of each sample. 
The way I have generally done this would be with a Dictionary<string, 
Sample>, but instead I can use a List<Sample> and access using linq. I don't 
know which would be preferable. Any thoughts? 
I have example code below. 
Thanks!
Ethan

With Dictionary
   Dictionary<string, Sample> samples = new Dictionary<string, Sample>();
                while (reader.Peek() > 0)
                {
                    string[] line = reader.ReadLine().Split('\t');
                    if (samples.ContainsKey(line[1]))
                    {
                        samples[line[1]].AddDyeChannel(line);
                    }
                    else
                    {
                        samples.Add(line[1], new Sample(line));
                    }
                }

With List and Linq
List<Sample> samples = new List<Sample>();
                while (reader.Peek() > 0)
                {
                    string[] line = reader.ReadLine().Split('\t');
                    var thisSample = from samp in samples
                                     where samp.SampleName == line[1]
                                     select samp;
                    switch (samples.Count)
                    {
                        case 0:
                            {
                                samples.Add(new Sample(line));

                                break;
                            }

                        case 1:
                            {
                                samples.First().AddDyeChannel(line);
                                break;
                            }
                        default:
                            {                               
                                throw new 
ArgumentException(string.Format("Sample {0} was in the list more than once.", 
line[1]));
                            }
                    }
                }

0
Utf
1/21/2010 7:48:15 PM
dotnet.languages.csharp 1931 articles. 0 followers. Follow

6 Replies
1223 Views

Similar Articles

[PageSpeed] 52

I messed up the linq example. 
I think the concept was probably still clear, but here is the way it should be
> List<Sample> samples = new List<Sample>();
>                 while (reader.Peek() > 0)
>                 {
>                     string[] line = reader.ReadLine().Split('\t');
>                     var thisSample = from samp in samples
>                                      where samp.SampleName == line[1]
>                                      select samp;
>                     switch (thisSample.Count())
>                     {
>                         case 0:
>                             {
>                                 samples.Add(new Sample(line));
> 
>                                 break;
>                             }
> 
>                         case 1:
>                             {
>                                 samples.First().AddDyeChannel(line);
>                                 break;
>                             }
>                         default:
>                             {                               
>                                 throw new 
> ArgumentException(string.Format("Sample {0} was in the list more than once.", 
> line[1]));
>                             }
>                     }
>                 }

0
Utf
1/21/2010 8:08:01 PM
Hey mate,

I think you could create an extension class for the Dictionary, and add that 
LINQ processing capability to it

Regards,


-- 
Angel J. Hernández M
MCP,MCAD,MCSD,MCDBA
Microsoft MVP

http://twitter.com/angeljesus14
http://msmvps.com/blogs/angelhernandez


"Ethan Strauss" <EthanStrauss@discussions.microsoft.com> wrote in message 
news:22F3118F-A453-42A1-A4C1-5DF305B68E5C@microsoft.com...
> Hi,
>   I am pretty new to Linq and I am not quite sure when it is best to use 
> it
> and when other methods might be preferable.
> For example, I need to create a list of Sample objects which I then access
> by the SampleName property of each sample.
> The way I have generally done this would be with a Dictionary<string,
> Sample>, but instead I can use a List<Sample> and access using linq. I 
> don't
> know which would be preferable. Any thoughts?
> I have example code below.
> Thanks!
> Ethan
>
> With Dictionary
>   Dictionary<string, Sample> samples = new Dictionary<string, Sample>();
>                while (reader.Peek() > 0)
>                {
>                    string[] line = reader.ReadLine().Split('\t');
>                    if (samples.ContainsKey(line[1]))
>                    {
>                        samples[line[1]].AddDyeChannel(line);
>                    }
>                    else
>                    {
>                        samples.Add(line[1], new Sample(line));
>                    }
>                }
>
> With List and Linq
> List<Sample> samples = new List<Sample>();
>                while (reader.Peek() > 0)
>                {
>                    string[] line = reader.ReadLine().Split('\t');
>                    var thisSample = from samp in samples
>                                     where samp.SampleName == line[1]
>                                     select samp;
>                    switch (samples.Count)
>                    {
>                        case 0:
>                            {
>                                samples.Add(new Sample(line));
>
>                                break;
>                            }
>
>                        case 1:
>                            {
>                                samples.First().AddDyeChannel(line);
>                                break;
>                            }
>                        default:
>                            {
>                                throw new
> ArgumentException(string.Format("Sample {0} was in the list more than 
> once.",
> line[1]));
>                            }
>                    }
>                }
> 
0
Angel
1/21/2010 9:49:59 PM
Ethan Strauss wrote:
> Hi, 
>    I am pretty new to Linq and I am not quite sure when it is best to use it 
> and when other methods might be preferable.

Generally speaking, use LINQ when it allows the code to express your 
_intent_ more clearly.  Especially if the code becomes simpler as a 
result (which it often can, if LINQ is a better expression of intent).

A main goal of LINQ is to allow the code to move away from a literal 
expression of the _mechanism_ and toward a more descriptive, intentional 
expression.

> For example, I need to create a list of Sample objects which I then access 
> by the SampleName property of each sample. 
> The way I have generally done this would be with a Dictionary<string, 
> Sample>, but instead I can use a List<Sample> and access using linq. I don't 
> know which would be preferable. Any thoughts? 

I would say that just because LINQ exists, that doesn't negate the 
existing rules of thumb for choice of data structure.  In particular, in 
your example you are specifically mapping a key to a specific instance, 
which is exactly what the Dictionary<TKey, TValue> type does.

On the other hand, the LINQ implementation you've shown doesn't really 
express the actual operation you're interested in very well.  And on top 
of that, it's WAY more expensive computationally than using 
Dictionary<TKey, TValue>.

I'd say that for this specific example at least, LINQ is a clear loser, 
at least used the way you've written it.

It's hard to know with such a minimal code example, but it's possible 
that if you extended your LINQ expression to use the "group" keyword, so 
that LINQ does all the work of maintaining the dictionary, that actually 
would express the intent better.  For example:

First, encapsulate the i/o as an IEnumerable, so that it fits into LINQ:

   IEnumerable<string[]> ReadLines()
   {
     while (reader.Peek() > 0)
     {
       yield return reader.ReadLine().Split('\t');
     }
   }

Then elsewhere:

   var result =
     from line in ReadLines()
     group line by line[1];

   foreach (IEnumerable<string[]> grouped in result)
   {
     Sample sample = null;

     foreach (string[] line in grouped)
     {
       if (sample == null)
       {
         sample = new Sample(line);
       }
       else
       {
         sample.AddDyeChannel(line);
       }
     }

     // save the Sample instance somewhere?
   }

The above example becomes even more expressive if you can allocate an 
empty Sample instance:

   var result =
     from line in ReadLines()
     group line by line[1];

   foreach (IEnumerable<string[]> grouped in result)
   {
     Sample sample = new Sample();

     foreach (string[] line in grouped)
     {
       sample.AddDyeChannel(line);
     }

     // save the Sample instance somewhere?
   }

In other words, the above does this:

   – create a query from the data source, grouping each line according 
to the key
   – enumerate all the groups:
     – for each group, enumerate all the dye channels, adding them to 
the Sample current instance

As you can see from the above, using LINQ works best if your data 
structures and code are designed with LINQ in mind.  Mapping it after 
the fact results in less elegant expressions and usages.

The Dictionary<string, Sample> version is fine.  It works, it's 
efficient, and experienced programmers will recognize the pattern.  But 
it's much better at expressing the actual mechanism being used, than it 
is the end goal the code has.  IMHO, the LINQ version does the latter 
better.  But of course, doing it properly requires more than just 
throwing some LINQ at the problem.  You have to throw the _right_ LINQ 
at the problem, and that may involve some up-front work so that the 
problem is represented in a way that suits LINQ better.

On that last point, note that I didn't _have_ to create an iterator 
method to do that.  I could have started with a List<string[]> populated 
by a loop, and then executed the query against the List<string[]> 
instance.  But that would have been inefficient, because it would 
require the intermediate data structure.  Using an iterator method, the 
original input is filtered directly into LINQ, allowing it to do all of 
the mechanical work.

Hope that helps!

Pete
0
Peter
1/22/2010 12:04:10 AM
Hello,

As show by the code you posted in this case LINQ looks a bit overkill to me. 
The more complex what you are doing is, the better it is (for example 
grouping files by estension and computing the total of the size would be 
clearly expressed using a LINQ query).

If you just need to access a dictionary it seems really overkill

--
Patrice


"Ethan Strauss" <EthanStrauss@discussions.microsoft.com> a �crit dans le 
message de groupe de discussion : 
22F3118F-A453-42A1-A4C1-5DF305B68E5C@microsoft.com...
> Hi,
>   I am pretty new to Linq and I am not quite sure when it is best to use 
> it
> and when other methods might be preferable.
> For example, I need to create a list of Sample objects which I then access
> by the SampleName property of each sample.
> The way I have generally done this would be with a Dictionary<string,
> Sample>, but instead I can use a List<Sample> and access using linq. I 
> don't
> know which would be preferable. Any thoughts?
> I have example code below.
> Thanks!
> Ethan
>
> With Dictionary
>   Dictionary<string, Sample> samples = new Dictionary<string, Sample>();
>                while (reader.Peek() > 0)
>                {
>                    string[] line = reader.ReadLine().Split('\t');
>                    if (samples.ContainsKey(line[1]))
>                    {
>                        samples[line[1]].AddDyeChannel(line);
>                    }
>                    else
>                    {
>                        samples.Add(line[1], new Sample(line));
>                    }
>                }
>
> With List and Linq
> List<Sample> samples = new List<Sample>();
>                while (reader.Peek() > 0)
>                {
>                    string[] line = reader.ReadLine().Split('\t');
>                    var thisSample = from samp in samples
>                                     where samp.SampleName == line[1]
>                                     select samp;
>                    switch (samples.Count)
>                    {
>                        case 0:
>                            {
>                                samples.Add(new Sample(line));
>
>                                break;
>                            }
>
>                        case 1:
>                            {
>                                samples.First().AddDyeChannel(line);
>                                break;
>                            }
>                        default:
>                            {
>                                throw new
> ArgumentException(string.Format("Sample {0} was in the list more than 
> once.",
> line[1]));
>                            }
>                    }
>                }
>
> 

0
Patrice
1/22/2010 2:59:32 PM
Thanks everyone. 
I will remove the linq. 
Ethan
0
Utf
1/25/2010 3:06:01 PM
Linq is costlier interms of data extraction ..

So recommend you to use traditional methods.

"Angel J. Hernandez M." <angeljesus14@hotmail.com> wrote in message 
news:eYegwOumKHA.3840@TK2MSFTNGP06.phx.gbl...
> Hey mate,
>
> I think you could create an extension class for the Dictionary, and add 
> that LINQ processing capability to it
>
> Regards,
>
>
> -- 
> Angel J. Hern�ndez M
> MCP,MCAD,MCSD,MCDBA
> Microsoft MVP
>
> http://twitter.com/angeljesus14
> http://msmvps.com/blogs/angelhernandez
>
>
> "Ethan Strauss" <EthanStrauss@discussions.microsoft.com> wrote in message 
> news:22F3118F-A453-42A1-A4C1-5DF305B68E5C@microsoft.com...
>> Hi,
>>   I am pretty new to Linq and I am not quite sure when it is best to use 
>> it
>> and when other methods might be preferable.
>> For example, I need to create a list of Sample objects which I then 
>> access
>> by the SampleName property of each sample.
>> The way I have generally done this would be with a Dictionary<string,
>> Sample>, but instead I can use a List<Sample> and access using linq. I 
>> don't
>> know which would be preferable. Any thoughts?
>> I have example code below.
>> Thanks!
>> Ethan
>>
>> With Dictionary
>>   Dictionary<string, Sample> samples = new Dictionary<string, Sample>();
>>                while (reader.Peek() > 0)
>>                {
>>                    string[] line = reader.ReadLine().Split('\t');
>>                    if (samples.ContainsKey(line[1]))
>>                    {
>>                        samples[line[1]].AddDyeChannel(line);
>>                    }
>>                    else
>>                    {
>>                        samples.Add(line[1], new Sample(line));
>>                    }
>>                }
>>
>> With List and Linq
>> List<Sample> samples = new List<Sample>();
>>                while (reader.Peek() > 0)
>>                {
>>                    string[] line = reader.ReadLine().Split('\t');
>>                    var thisSample = from samp in samples
>>                                     where samp.SampleName == line[1]
>>                                     select samp;
>>                    switch (samples.Count)
>>                    {
>>                        case 0:
>>                            {
>>                                samples.Add(new Sample(line));
>>
>>                                break;
>>                            }
>>
>>                        case 1:
>>                            {
>>                                samples.First().AddDyeChannel(line);
>>                                break;
>>                            }
>>                        default:
>>                            {
>>                                throw new
>> ArgumentException(string.Format("Sample {0} was in the list more than 
>> once.",
>> line[1]));
>>                            }
>>                    }
>>                }
>> 


0
DSK
1/27/2010 3:48:07 PM
Reply:

Similar Artilces:

Unable to open dictionary E:Dynamics/Reports
Hello. One of our users receives the above message when trying to print. It is then followed with another error - - Problem Starting Up Report. We have lost our Dynamics Support person and would appreciate any tips and suggestions. Here is her description of the problem: 'I keep getting errors whenever I choose print from the PO screen' Then she provided screen prints showing the errors messages above. Thanks!! It appears that the reports dictionary is placed on a shared directory - e:\dynamics\reports. Talk to your network support and ensure that she has full access or ...

How to MoveFirst, MoveNext, MovePrevious, MoveLast in LinQ To XMl Please Help
I have the Next XML var xml = new XElement( "clients", new XElement("client", new XAttribute("id",1), new XElement( "name", "Luis"), new XElement( "country", "Portugal") ), new XElement("client", new XAttribute("id",2), n...

LINQ to XML - Performance
Hi, Can anyone tell me how the performance compares between working with xml documents in the normal way (i.e. with xpath and the System.Xml) and LINQ. Is it any quicker or slower? Are there are distinct benefits to the user (and not just advantages for the coder) to working with LINQ? The work i will be doing is creating an xml document out of segments from other xml documents, transforming the document (XSL) and then retrieving/amending/appending data to the document. Currentlly xml transformations in .net 2.0 are very slow and performance takes a real hit with complex transforms. ...

American/UK English dictionary problems
Only a small problem but most annoying, my outlook keeps spell checking in American instead of English (UK). It randomly alternates between checking between U.K. and U.S.. There is no pattern that I can see. I have confirmed the 'Regional Settings' in Control Panel are set to 'English (UK)' and the same for Input Locales. Also in Outlook/Tools/Options/ Spelling Tab - International dictionaries is also set to 'English (UK)' What else can be causing this. Using Windows XP and Office XP 2002 ...

Linq or dictionary
Hi, I am pretty new to Linq and I am not quite sure when it is best to use it and when other methods might be preferable. For example, I need to create a list of Sample objects which I then access by the SampleName property of each sample. The way I have generally done this would be with a Dictionary<string, Sample>, but instead I can use a List<Sample> and access using linq. I don't know which would be preferable. Any thoughts? I have example code below. Thanks! Ethan With Dictionary Dictionary<string, Sample> samples = new Dictionary<strin...

Linq to BindingList
Hello. How can I send the result of a LINQ query to a BindingList? I say not to do this: <Customer> List lst = (from cust in select new dataContext.Customer Customer (cust)). ToList <Customer> (); foreach (Customer c in lst) lbindingListCust.Add (c); Any ideas? ...

Dictionaries in Office 2003 email
I have set the default dictionary to English (UK) under Tools, Language, but whenever I check the spelling of an email before i send it, Outlook always defaults back to English (US). How can I make it stick to English (UK)? ...

populate a DataSet via a LINQ query (Linq to XML)
Is there a way to populate a DataSet via a LINQ query? (Linq to XML) Instead of; DataSet ds = new DataSet(); ds.ReadXml(myfile.xml, XmlReadMode.InferTypedSchema); dataGridView1.DataSource = ds.DefaultViewManager; dataGridView1.DataMember = "myNode"; Anthony Anthony wrote: > Is there a way to populate a DataSet via a LINQ query? > > (Linq to XML) > > Instead of; > DataSet ds = new DataSet(); > ds.ReadXml(myfile.xml, XmlReadMode.InferTypedSchema); > dataGridView1.DataSource = ds.DefaultViewManage...

Dictionary update
The problem is: I have my .cnk (dic) file and updating workstation (few new forms, few modified standart forms and reports). If I do it once (on a clean installation) everything looks good and everything is working. If I try to install it once again on the same workstation all text field (new text fields) messed up. I mean, name of buttons, simple text on a report are messed, like it was changed. What it can be? SBF 8.0 ...

Need Linq Help
I need linq help. I have a dictionary where the keys are strings and I need to select from that dictionary into another dictionary where the first two characters of the key match a parameter. For exmaple here is the code: Dictionary<string, string> origDict =3D new Dictionary<string, string>(); origDict.Add(""BSOne", "1") origDict.Add(""BSTwo", "2") origDict.Add(""PLOne", "11") origDict.Add(""PLTwo", "22") I need to select into a new dictionary only where the keys star...

"Add" (word to dictionary) greyed out in MS Word context menu?
Version: 2008 Operating System: Mac OS X 10.5 (Leopard) Processor: Intel The subject line pretty much says it all. <br> I type a lot of words that are not in the standard MS Word dictionary (like OChem and dodecanol, etc.), and I have the option to &quot;Ignore&quot; and &quot;Ignore All&quot;, but &quot;Add&quot; is greyed out and I'd really like to fix that. <br><br>Thanks, <br><br>Justin Hi Justin; Is this a new development or have you never been able to use it? Is Office fully updated (12.2.3)? Have you repaired disk per...

Linq to XML?
I have five items of information I need to extract from XML covering upwards of 25 separate devices. I'm obtaining these values via five Linq to XML queries as follows: IEnumerable<string> EIDs = (from env in xdoc.Root.Elements("packet"). Elements(ns1 + "data").Elements(ns2 + "server_group"). Elements(ns2 + "env") select (string)env.Element(ns3 + "eid")); IEnumerable<int> IDs = (from env in xdoc.Root.Elements("packet"). Elements(ns1 + "data").Elem...

Linq query
Hello, I have the following list: IList<Int32> roles = { 1, 2, 3 } I need to get all users where in user.Roles there is at least one Role which is id 1, 2 OR 3. var a = users.Where(u => u.Roles. ??? ); How can I do this? Thanks, Miguel shapper wrote: > I have the following list: > > IList<Int32> roles = { 1, 2, 3 } > > I need to get all users where in user.Roles there is at least one Role > which is id 1, 2 OR 3. > var a = users.Where(u => u.Roles. ??? ); users.Where(u => u.Roles.Any(r => roles.Contains(r))) ass...

Setting Custom Dictionary Based on Document
Hi, Does anyone know if it is possible to set the default custom dictionary based on the current document? I use word on private letters and work-based manuscripts, which each have their own specialist vocabulary. It is easy enough to have two custom dictionaries, but when I right-click to add a word to the dictionary, there is no choice of which dictionary to add to; it always goes in the current default one. If I change from working on a private letter to a manuscript, it is a real pain to have to remember to go into the proofing settings to change the default dictionary. Th...

Dictionaries for Office v.X
Hi. I would like to install various dictionaries (Italian, Spanish etc..) in Office v.X, OS 10.3.9, but I simply can't find them -looked for them everywhere!! Mactopia, P2P etc.. I imagine they must exist, as there are country-specific versions of the software...does anyone know WHERE I can find such dictionaries? Thanks. Did you look on the Office X CD, including in the Value Pack? I don't remember installing Office X, but I believe the way the Mac version works is that the US version has almost all the proofing tools. However, they may not be set for a default install, so you ...

Removing words from the standard dictionary
I'm the sort of person who spells role as r�le and I've often wondered if a mechanism exists to remove the word "role" from the standard dictionary, or perhaps override it somehow, with my preferred spelling. Similarly, I never find a use for the word "poser" in my business communications, but frequently type it in place of "power", with unfortunate consequences. So I'd remove "poser" from the dictionary as well. Is there hope for me, and my Office 2003? -- Steve Swift http://www.ringers.org.uk (Personal Webpage) http://hedgeh...

LINQ to XML
This is my XML file: <?xml version="1.0" encoding="utf-8" ?> <Profiles xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.mycompany.com/MyApp/2010/03/MySchema"> <Profile id="0" name="MyProfileName1"> <Entity name="EntityName1" type="EntityTypeName1"> <Shared> <Property name="SharedPropertyName1" type="SharedPropertyType1" /> <Property name="SharedPropertyName2" type="SharedPropert...

RE: LINQ to XML and Amazon Webservices
I am not able to reply to my previous thread wich had the same title, so here goes: I added the namespace which made no difference. There are no prefixes in the XML, which I'm posting below, so I've asumed no need for namespace. Am I wrong? Anyway, this has become very strange. When I use the loop Martin has suggested, it never executed - so ResponseDoc...<Item> is an empty list, or collection. When I do > For Each item As XElement In ResponseDoc...<ASIN> > Console.WriteLine("ASIN: {0}", item.Value) > Next I do ...

HRP Dictionary GP10.0
Hi, We have GP 10.0 SP3, Payroll Tax Update 070309 and PayrollSP3 installed. But when just open GP we got the message that "No HRP Dictionary is available on this machine". How can we get this dictionary? Any help would be appreciated -- Gilberto Villegas GP Business Solutions partner Gilberto, Did you install Human Resources from the Installation media? -- Thanks Janakiram M.P. MCP-GP http://janakirammp.blogspot.com "Gilberto" wrote: > Hi, > > We have GP 10.0 SP3, Payroll Tax Update 070309 and PayrollSP3 installed. > But when just open GP we got ...

Linq to sql question
Hi. I have some simple tables. - ER_Person table (Person_Id, LogonId, FirstName, LastName, EMail) - ER_Section table (Section_Id, SectionCode, SectionName) - ER_PersonSection table (Person_Id, Section_Id)- this table takes care of a many-to-many relationship between person and section. A person can be connected to several sections and this table makes that possible. I'm using vs2008 and the objectdesigner. In my application (Winforms) I retrieve a person: var person = ProjectGlobal.rd.ER_Persons.Single(c => c.LogonId == ALogonId.ToUpper()); This is retrieved by the us...

LINQ and Where clause
Hello everyone, I need to know how to use a WHERE clause to weed out elements that are not present. If I remove the where altogether and all elements are present app runs as should. However, sometimes the element "ThumbNail" is not present and app fails - stories not set. I have tried: Where story.Element("thumbnail") is not nothing Where story.Element("thumbnail") <> "" Where story.Element("thumbnail") not nothing What is missing? I have included the sub in question and also an example xml file. If you look at the xml, one story i...

won't add words to dictionary
I am using Outlook 2007. I have a custom dictionary to use and I have "suggest from main dictionary only" unchecked. How do I get the spell checker to allow me to add a word to the dictionary (the button is grayed out)? The custom dictionary is: "Custom.dic" in "C:\Documents and Settings\User\Application Data\Microsoft\Proof", all languages, and set to default (this one has words listed from my previous version of MSOffice and is longer). I also have "Custom.dic" in "C:\Documents and Settings\User\Application Data\Microsoft\UProof", all la...

Create a complex type from Linq-to-XML
Hi, I have a User object with two properties, ID and Name I have an XML file that looks like this: <?xml version="1.0" encoding="utf-8" ?> <Users> <User> <ID>4</ID> <Name>Paul</Name> </User> <User> <ID>3</ID> <Name>John</Name> </User> <User> <ID>2</ID> <Name>George</Name> </User> <User> <ID>1</ID> <Name>Ringo</Name...

Serialization/LINQ
Given var myFile = (from file in fileList // Most recent file orderby file.CreationTime descending select new { file.FullName, fs = file.Length }).First(); - What is the easiest way to serialize myFile? (need the XML to show the name/value pair for each value) - What is the easiest way to SOAP serialize myFile? (need the XML to show the name/value pair for each value as well as the type i.e string for FullName & int for fs) I was hoping for the var myFile object to expose a Serialize method but I can't find one. Thanks for...

How to remove a word from dictionary?
I added a mispelled word to my dictionary, how can I remove it? You need to find your custom dictionary. It should be located at the following: Root\OS\Profiles\User_name\Application Data\Microsoft\Proof The file is generally named custom.dic. Open the file is notepad or similar text application. Find the word you don't want. Delete it. Save the file. NOTE: Make sure to save the file as .dic not .txt That should correct your problem. "robmirabile" wrote: > I added a mispelled word to my dictionary, how can I remove it? Excel shares spelling dictionaries with ...