<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="https://www.w3.org/2005/Atom" xmlns:sy="https://purl.org/rss/1.0/modules/syndication/" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:content="https://purl.org/rss/1.0/modules/content/" xmlns:wfw="https://wellformedweb.org/CommentAPI/" xmlns:slash="https://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>I am - therefore I think (sometimes)</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/christianb/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/christianb/feed.xml</link>
    <description>A blog on C.S. incorporating this and that from AI and adjacent fields - mostly as a blue print to document a personal learning process ...</description>
    <lastBuildDate>Wed, 17 Apr 2019 03:19:20 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>Data and Analytics Cool</title>
      <link>https://docs.microsoft.com/archive/blogs/christianb/data-and-analytics-cool</link>
      <pubDate>Tue, 10 Jan 2012 13:19:22 GMT</pubDate>
      <dc:creator><![CDATA[cbitter]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/christianb/2012/01/10/data-and-analytics-cool/</guid>
      <description><![CDATA[Today’s post is a mere link dump about current preview projects coming straight from SQL Azure Labs,...]]></description>
      <content:encoded><![CDATA[<p>Today’s post is a mere link dump about current preview projects coming straight from SQL Azure Labs, CodePlex and MSR. As origin suggests, all projects have a strong focus on the building blocks of our information economy - data.</p>  <p>Now without further ado:</p>  <ol>   <li><a href="https://www.microsoft.com/en-us/sqlazurelabs/labs/dataexplorer.aspx">Microsoft Codename &quot;Data Explorer&quot;</a>      <br />      <br />Data explorer is a new cool tool (either client or as a preview-service in the cloud) to take in arbitrarily shaped data and mix and match and turn and twirl it around as you please. Do you want to peek on the price of a cool gadget you wish to buy of your beloved online retailer?! Take Data explorer use your query as input source, apply some transformations to it and get a list of providers along with their suggested price as output. Or maybe you want to know what somebody said on twitter about your cool project, well guess what there is Data Explorer to the rescue.&#160;&#160;&#160;&#160;&#160; <br /></li>    <li><a href="https://www.microsoft.com/en-us/sqlazurelabs/labs/numerics.aspx">Microsoft Codename “Cloud Numerics”</a>      <br />      <br />Do you want to be the next cloud data scientist of the year? Well now you can … write and use the analytics models you imagined but weren’t able to get converging because it took so long. Do you want to design extensive experiments for your company leveraging first class cloud power to drive generation of real value from data? Well now you can!      <br /></li>    <li><a href="https://www.microsoft.com/en-us/sqlazurelabs/labs/socialanalytics.aspx">Microsoft Codename &quot;Social Analytics&quot;</a>      <br />      <br />These days, it’s all about social. Whether it is connecting and sharing with the people you know or as a company finding out about your customers. The social revolution is only starting. If you want to get started on developing in the social context, this lab might be for you:      <br />      <br />Microsoft Codename &quot;Social Analytics&quot; is an experimental cloud service. It’s aimed at developers who want to integrate social web information into business applications.       <br /></li>    <li><a href="https://www.microsoft.com/en-us/sqlazurelabs/labs/datatransfer.aspx">Microsoft Codename &quot;Data Transfer&quot;</a>      <br />      <br />How do you actually get data into the cloud and perform this jucy analysis on it that I was writing about above? Don’t worry there is a pair of shoes just right for you:      <br />      <br />Microsoft Codename &quot;Data Transfer&quot; is an easy-to-use Web application to move your data into SQL Azure or Windows Azure Blob storage.      <br /></li>    <li><a href="https://research.microsoft.com/en-us/downloads/21e87d72-782d-4657-82c4-4f77c2b547ca/default.aspx">Infer.NET Fun: An F# Library for Probabilistic Programming</a>      <br />      <br />F#’s strong suit is the expression of non-trivial data transformation as it is needed in technical and scientific computing. Clearly, you can built abstractions for reasoning on and learning from graphical&#160; models all by yourself. But why not take more advantage of the smart folks over at MSR (yes F# is a lot of MSR love) ?! Well you can with Infer.NET Fun:      <br />      <br />FSoft is an F# library for probabilistic programming. It enables you to write generative models as functional programs, run them to obtain samples, and quote them to infer distributions via Infer.NET.      <br /></li>    <li><a href="https://mysemanticsearch.codeplex.com/">MySemanticSearch Example on CodePlex</a>      <br />      <br />SQL Server 2012 is almost here (in RC form it is) and with it it’s new semantic search capabilities will arrive as well. Just imagine the vector-space model on stereoids instead of stemming and matching it’s all about taking care of natural language’s fuzziness using statistics and similarities.</li> </ol>  <p>With that, I’ll leave you to your experimentation – read you soon.</p>]]></content:encoded>
    </item>
    <item>
      <title>F#, Wordle and Visual Text Analysis</title>
      <link>https://docs.microsoft.com/archive/blogs/christianb/f-wordle-and-visual-text-analysis</link>
      <pubDate>Sat, 10 Dec 2011 06:38:02 GMT</pubDate>
      <dc:creator><![CDATA[cbitter]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/christianb/2011/12/10/f-wordle-and-visual-text-analysis/</guid>
      <description><![CDATA[In the previous post, I presented Wordle as a beautiful tool to compress natural language...]]></description>
      <content:encoded><![CDATA[<p>In the previous post, I presented <a href="https://www.wordle.net/">Wordle</a> as a beautiful tool to compress natural language “documents”, i.e. a document is a sequence of words, into an aggregate – the word cloud. Consequently, while a multiset of documents may be hard to understand from the standpoint of information content, presented concepts, etc. an aggregate, summary, abstract, the gist of them may yield quick (but incomplete) insight. For this, terms such as (customer) sentiment analysis, document summarisation, information retrieval and natural language understanding often pop up, when value (in a business or purely abstract meaning) is sought to be gained from natural language (documents).</p>  <p>This blog post aims much lower in that I want to use a tool chain, i.e. F# and Wordle to aggregate a document into something that can be analysed by the (currently available) best processor – the human brain. So, assuming a text is made up of words that represent the topic(s) of the text, those words that appear frequently might help us to hypothesise about the topic(s) of the text.</p>  <p>Now, the problem is phrased in such a way that it actually gives away the simple and unrealistic solution:</p>  <ol>   <li>Extract words from text.      <br />      <br />A word is a sequence of letters of an alphabet.       <br />For simplicity’s sake, an english word is made up of only letters. That is, we do not accept <a href="https://en.wikipedia.org/wiki/Contraction_(grammar)">contractions</a>, <a href="https://en.wikipedia.org/wiki/Clitic">clitics</a>, named entities (like R2D2, etc.), numbers, etc.. Words are delivered as a sequence line by line.       <br /></li>    <li>Remove words that are invalid (with respect to point (1.)).</li>    <li>Transform words into a common format, i.e. lower case without whitespace at pre/post-fix position.</li>    <li><a href="https://en.wikipedia.org/wiki/Stop_words">Stop words</a>, i.e. frequent words increasing noise in a text, will be removed.</li>    <li>Count each word, i.e. whenever a word occurs we give it a one (remember how we used to count as a kid …).</li>    <li>Output the count of each word, i.e. “&lt;word&gt; 1”.</li>  </ol>  <p>If you feel like you have seen this a lot recently – Yes, it looks and feels like the <a href="https://www.microsoft.com/sqlserver/en/us/solutions-technologies/business-intelligence/big-data-solution.aspx">Hadoop</a> “Hello World” example. Consequently, the code is similar and laid out in such a way that you can use it in a <a href="https://hadoop.apache.org/common/docs/stable/streaming.html">Hadoop streaming</a> scenario, i.e. the code is put into a container/ program &quot;called FMapper, which takes as input from stdin:</p>  <div class="csharpcode">   <pre class="alt"><font size="1"><span class="lnum">   1:  </span>  let invalidWordsReg = Regex( <span class="str">&quot;^\d+$|^\d+\w+$|^\w+\d+$|^\d+.+$|\s+|(�|©|@|®)+&quot;</span> )</font></pre>
  <font size="1"></font>

  <pre><font size="1"><span class="lnum">   2:  </span>  let mutable line = <span class="str">&quot;&quot;</span></font></pre>
  <font size="1"></font>

  <pre class="alt"><font size="1"><span class="lnum">   3:  </span>  <span class="kwrd">while</span> line &lt;&gt; <span class="kwrd">null</span> <span class="kwrd">do</span></font></pre>
  <font size="1"></font>

  <pre><font size="1"><span class="lnum">   4:  </span>      </font></pre>
  <font size="1"></font>

  <pre class="alt"><font size="1"><span class="lnum">   5:  </span>    line &lt;- Console.ReadLine()</font></pre>
  <font size="1"></font>

  <pre><font size="1"><span class="lnum">   6:  </span>&#160;</font></pre>
  <font size="1"></font>

  <pre class="alt"><font size="1"><span class="lnum">   7:  </span>    <span class="kwrd">if</span> (String.IsNullOrEmpty(line) = <span class="kwrd">false</span>) then</font></pre>
  <font size="1"></font>

  <pre><font size="1"><span class="lnum">   8:  </span>&#160;</font></pre>
  <font size="1"></font>

  <pre class="alt"><font size="1"><span class="lnum">   9:  </span>      let words = line.Split([|<span class="str">&quot; &quot;</span>; <span class="str">&quot;/&quot;</span>; <span class="str">&quot;\\&quot;; &quot;</span>,<span class="str">&quot;; &quot;</span>.<span class="str">&quot;; &quot;</span>;<span class="str">&quot;; &quot;</span>?<span class="str">&quot;; &quot;</span>!<span class="str">&quot;; &quot;</span>:<span class="str">&quot;; </span></font></pre>
  <font size="1"></font>

  <pre><font size="1"><span class="lnum">  10:  </span>        &quot;)<span class="str">&quot;; &quot;</span>(<span class="str">&quot;; &quot;</span>&lt;<span class="str">&quot;; &quot;</span>&gt;<span class="str">&quot;; &quot;</span>[<span class="str">&quot;; &quot;</span>]<span class="str">&quot;; &quot;</span>}<span class="str">&quot;; &quot;</span>{<span class="str">&quot;; </span></font></pre>
  <font size="1"></font>

  <pre class="alt"><font size="1"><span class="lnum">  11:  </span>        &quot;+<span class="str">&quot;; &quot;</span>-<span class="str">&quot;; &quot;</span>*<span class="str">&quot;; &quot;</span>%<span class="str">&quot;; &quot;</span>_<span class="str">&quot;; &quot;</span>#<span class="str">&quot;; &quot;</span>&amp;<span class="str">&quot;;</span></font></pre>
  <font size="1"></font>

  <pre><font size="1"><span class="lnum">  12:  </span>        &quot;§<span class="str">&quot;; &quot;</span>$<span class="str">&quot;; &quot;</span>~<span class="str">&quot;; &quot;</span>|<span class="str">&quot;; &quot;</span>^<span class="str">&quot;;</span></font></pre>
  <font size="1"></font>

  <pre class="alt"><font size="1"><span class="lnum">  13:  </span>        &quot;\<span class="str">&quot;&quot;</span>; <span class="str">&quot;'&quot;</span>; <span class="str">&quot;=&quot;</span>; <span class="str">&quot;”&quot;</span>; <span class="str">&quot;“&quot;</span>|], StringSplitOptions.RemoveEmptyEntries)</font></pre>
  <font size="1"></font>

  <pre><font size="1"><span class="lnum">  14:  </span>&#160;</font></pre>
  <font size="1"></font>

  <pre class="alt"><font size="1"><span class="lnum">  15:  </span>      words</font></pre>
  <font size="1"></font>

  <pre><font size="1"><span class="lnum">  16:  </span>      |&gt; Seq.map(fun word -&gt; word.Trim() )</font></pre>
  <font size="1"></font>

  <pre class="alt"><font size="1"><span class="lnum">  17:  </span>      |&gt; Seq.map(fun word -&gt; word.Replace(<span class="str">&quot;”&quot;</span>, <span class="str">&quot;&quot;</span>).Replace(<span class="str">&quot;“&quot;</span>, <span class="str">&quot;&quot;</span>))</font></pre>
  <font size="1"></font>

  <pre><font size="1"><span class="lnum">  18:  </span>      |&gt; Seq.map(fun word -&gt; word.ToLowerInvariant())</font></pre>
  <font size="1"></font>

  <pre class="alt"><font size="1"><span class="lnum">  19:  </span>      |&gt; Seq.filter(fun word -&gt; (invalidWordsReg.IsMatch word ) = <span class="kwrd">false</span>)</font></pre>
  <font size="1"></font>

  <pre><font size="1"><span class="lnum">  20:  </span>      |&gt; Seq.filter(fun word -&gt; ( StopWords.isEnglishStopWord word ) = <span class="kwrd">false</span>)</font></pre>
  <font size="1"></font>

  <pre class="alt"><font size="1"><span class="lnum">  21:  </span>      |&gt; Seq.map(fun w -&gt; (w, 1))</font></pre>
  <font size="1"></font>

  <pre><font size="1"><span class="lnum">  22:  </span>      |&gt; Seq.iter(fun (w, c) -&gt; printfn <span class="str">&quot;%s\t%d&quot;</span> w c )</font></pre>
  <font size="1"></font>

  <pre class="alt"><font size="1"><span class="lnum">  23:  </span>&#160;</font></pre>
  <font size="1"></font>

  <pre><font size="1"><span class="lnum">  24:  </span>  done</font></pre>
</div>


<p> As you can see, the sample follows the imperative style (while loop). However, you might use a recursive function peeking on stdin and calling the word processing pipeline whenever there is a line of word(s) available to be processed. Is it necessary to output a 1 for each word? For the simple example, that is discussed here – NO. However, instead of outputting each single word, you might think about computing some summary statistic from that word, group of words, sentence, etc. For example, we might group the word sequence using a word as a key. Furthermore, imagine the distributed (Hadoop streaming) case, where local knowledge (each map step) has to be integrated to form global knowledge (the reduce step).&#160; Consequently, the simple mapper step serves two points:</p>

<ul>
  <li>Performing analysis (a very simple one in this case) </li>

  <li>Imposing a schema, i.e. from a non-relational text input to relational output “&lt;word&gt;, &lt;count&gt;”</li>
</ul>

<p>Now, the above program executed on a sample text taken from a SQL Server 2008 help page yields the following output, which illustrates the point of stop words. Yes, we did remove some of them but depending on your application domain you might even remove different ones or more.</p>

<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/28/94/metablogapi/0535.word-count_0986F7C8.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-28-94-metablogapi/0535.word_2D00_count_5F00_0986F7C8.png"><img style="margin-right: auto; margin-left: auto; float: none; display: block; background-image: none;" title="word count" border="0" alt="word count" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/28/94/metablogapi/2502.word-count_thumb_297254C5.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-28-94-metablogapi/2502.word_2D00_count_5F00_thumb_5F00_297254C5.png" width="129" height="244" /></a></p>

<p>What are we left with? We need to integrate the individual word counts. The following “Reducer” program takes care of this using a <font face="Consolas">Dictionary</font>. Global word counts are printed to standard output so that they can be used for further computation.</p>

<div class="csharpcode">
  <pre class="alt"><font size="1"><span class="lnum">   1:  </span>  let mutable line = <span class="str">&quot;&quot;</span></font></pre>
  <font size="1"></font>

  <pre><font size="1"><span class="lnum">   2:  </span>  let xmap = Dictionary&lt;<span class="kwrd">string</span>,<span class="kwrd">int</span>&gt;()</font></pre>
  <font size="1"></font>

  <pre class="alt"><font size="1"><span class="lnum">   3:  </span>&#160;</font></pre>
  <font size="1"></font>

  <pre><font size="1"><span class="lnum">   4:  </span>  <span class="kwrd">while</span> ( line &lt;&gt; <span class="kwrd">null</span> ) <span class="kwrd">do</span></font></pre>
  <font size="1"></font>

  <pre class="alt"><font size="1"><span class="lnum">   5:  </span>      </font></pre>
  <font size="1"></font>

  <pre><font size="1"><span class="lnum">   6:  </span>    line &lt;- Console.ReadLine()    </font></pre>
  <font size="1"></font>

  <pre class="alt"><font size="1"><span class="lnum">   7:  </span>&#160;</font></pre>
  <font size="1"></font>

  <pre><font size="1"><span class="lnum">   8:  </span>    <span class="kwrd">if</span> String.IsNullOrEmpty(line) = <span class="kwrd">false</span> then</font></pre>
  <font size="1"></font>

  <pre class="alt"><font size="1"><span class="lnum">   9:  </span>      let vLine = line.Split([|<span class="str">&quot;\t&quot;</span>|], StringSplitOptions.RemoveEmptyEntries)</font></pre>
  <font size="1"></font>

  <pre><font size="1"><span class="lnum">  10:  </span>&#160;</font></pre>
  <font size="1"></font>

  <pre class="alt"><font size="1"><span class="lnum">  11:  </span>      <span class="kwrd">if</span> Array.length vLine &lt;&gt; 2 then failwith <span class="str">&quot;invalid format of input data&quot;</span></font></pre>
  <font size="1"></font>

  <pre><font size="1"><span class="lnum">  12:  </span>&#160;</font></pre>
  <font size="1"></font>

  <pre class="alt"><font size="1"><span class="lnum">  13:  </span>      let key = vLine.[0]</font></pre>
  <font size="1"></font>

  <pre><font size="1"><span class="lnum">  14:  </span>      let cnt = Int32.Parse(vLine.[1])</font></pre>
  <font size="1"></font>

  <pre class="alt"><font size="1"><span class="lnum">  15:  </span>&#160;</font></pre>
  <font size="1"></font>

  <pre><font size="1"><span class="lnum">  16:  </span>      <span class="kwrd">if</span> ( xmap.ContainsKey key ) then</font></pre>
  <font size="1"></font>

  <pre class="alt"><font size="1"><span class="lnum">  17:  </span>        let v = xmap.Item( key )</font></pre>
  <font size="1"></font>

  <pre><font size="1"><span class="lnum">  18:  </span>        let newv = v + cnt</font></pre>
  <font size="1"></font>

  <pre class="alt"><font size="1"><span class="lnum">  19:  </span>        xmap.Item(key) &lt;- newv</font></pre>
  <font size="1"></font>

  <pre><font size="1"><span class="lnum">  20:  </span>      <span class="kwrd">else</span></font></pre>
  <font size="1"></font>

  <pre class="alt"><font size="1"><span class="lnum">  21:  </span>        xmap.Add( key, cnt )</font></pre>
  <font size="1"></font>

  <pre><font size="1"><span class="lnum">  22:  </span>&#160;</font></pre>
  <font size="1"></font>

  <pre class="alt"><font size="1"><span class="lnum">  23:  </span>  done</font></pre>
  <font size="1"></font>

  <pre><font size="1"><span class="lnum">  24:  </span>&#160;</font></pre>
  <font size="1"></font>

  <pre class="alt"><font size="1"><span class="lnum">  25:  </span>  xmap</font></pre>
  <font size="1"></font>

  <pre><font size="1"><span class="lnum">  26:  </span>  |&gt; Seq.iter(fun kvp -&gt; printfn <span class="str">&quot;%s:%d&quot;</span> kvp.Key kvp.Value )</font></pre>
</div>

<p>Now, we can test the tool chain by invoking the following command line: </p>

<p align="justify"><font face="Consolas">FMap.exe &lt; &quot;C:\TestData\SQLTestDocument.txt&quot; | FReduce.exe</font></p>

<p align="justify">The result of this computation can be seen in the following:</p>

<p align="justify"><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/28/94/metablogapi/8372.Cwordcount_755DB571.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-28-94-metablogapi/8372.Cwordcount_5F00_755DB571.png"><img style="border: 0px currentcolor; margin-right: auto; margin-left: auto; float: none; display: block; background-image: none;" title="Cwordcount" border="0" alt="Cwordcount" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/28/94/metablogapi/2021.Cwordcount_thumb_3B6E7285.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-28-94-metablogapi/2021.Cwordcount_5F00_thumb_5F00_3B6E7285.png" width="182" height="162" /></a></p>

<p align="justify">The last step left from our discussion is Wordle. That is, we feed those &lt;word,count&gt; pairs to Wordle. Either by going to the web site or by using the code snippet I presented previously. Either way - our result looks something like this:</p>

<p align="justify"><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/28/94/metablogapi/6303.wordle_5A44E663.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-28-94-metablogapi/6303.wordle_5F00_5A44E663.png"><img style="margin-right: auto; margin-left: auto; float: none; display: block; background-image: none;" title="wordle" border="0" alt="wordle" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/28/94/metablogapi/4130.wordle_thumb_266CCA45.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-28-94-metablogapi/4130.wordle_5F00_thumb_5F00_266CCA45.png" width="491" height="347" /></a></p>

<p align="justify">Now, simply by looking at the word cloud, we might conclude that the (unknown) document we analysed, might contain information about a “server” from “microsoft”, which has something to do with “sql”, “reporting” among other “services”. Maybe we could use this to query our search engine of choice, leading to maybe this result (or read the document <img class="wlEmoticon wlEmoticon-winkingsmile" alt="Zwinkerndes Smiley" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/28/94/metablogapi/3162.wlEmoticon-winkingsmile_4E0320A2.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-28-94-metablogapi/3162.wlEmoticon_2D00_winkingsmile_5F00_4E0320A2.png" /> ):</p>

<p align="justify"><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/28/94/metablogapi/8037.bing_0D60D433.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-28-94-metablogapi/8037.bing_5F00_0D60D433.png"><img style="margin-right: auto; margin-left: auto; float: none; display: block; background-image: none;" title="bing" border="0" alt="bing" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/28/94/metablogapi/5710.bing_thumb_690BC9E3.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-28-94-metablogapi/5710.bing_5F00_thumb_5F00_690BC9E3.png" width="494" height="257" /></a></p>

<p align="justify">Closing remarks:</p>

<p align="justify">The method presented is far from a real world example of automatic summarisation, customer sentiment analysis and other computational problems, which aim to bring structure and/or sense to natural language documents. The meaning of and relationship between words was totally ignored. For example:</p>

<ol>
  <li>
    <div align="justify">SQL is an acronym for structured query language but if both occur in a document, we have 4 words (SQL, structured, query, and language) instead of just on representative for SQL.</div>
  </li>

  <li>
    <div align="justify">No handling of synonyms. Assuming the text contained some word and a lot of (different) synonyms for that word, depending on the frequency of the word and its synonyms, we might or might not have noticed the topic the word and its synonyms represent.</div>
  </li>

  <li>
    <div align="justify">To be or not to be. That is, the small word not (or no, etc.) reverses a statement (negation) or is used to emphasise a statement ( rhetorical question ). Now assuming, each time our high frequency words occurred with a negation, we would still have gotten high counts for those words but the documents topic might be opposite to our impression.</div>
  </li>

  <li>
    <div align="justify">A more realistic solution would make use of machinery, such as <a href="https://en.wikipedia.org/wiki/Latent_semantic_analysis">LSA</a>, <a href="https://en.wikipedia.org/wiki/Principal_component_analysis">PCA</a>, <a href="https://en.wikipedia.org/wiki/Tf%E2%80%93idf">tf-idf</a> and the <a href="https://en.wikipedia.org/wiki/Vector_space_model">vector space model</a> (as a common metaphore).</div>
  </li>
</ol>

<p>Takeaway:</p>

<p>Natural language processing, F# and Wordle are fun and go together excellently <img class="wlEmoticon wlEmoticon-smile" alt="Smiley" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/28/94/metablogapi/3247.wlEmoticon-smile_28C58A9C.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-28-94-metablogapi/3247.wlEmoticon_2D00_smile_5F00_28C58A9C.png" /> - Read you soon!</p>]]></content:encoded>
    </item>
    <item>
      <title>F# and Wordle</title>
      <link>https://docs.microsoft.com/archive/blogs/christianb/f-and-wordle</link>
      <pubDate>Thu, 01 Dec 2011 06:41:00 GMT</pubDate>
      <dc:creator><![CDATA[cbitter]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/christianb/2011/12/01/f-and-wordle/</guid>
      <description><![CDATA[For those of us, who have not yet heard of Wordle:

Wordle is a toy for generating &ldquo;word...]]></description>
      <content:encoded><![CDATA[<p>For those of us, who have not yet heard of <a href="https://www.wordle.net/">Wordle</a>:</p>
<blockquote>
<p><em>Wordle is a toy for generating &ldquo;word clouds&rdquo; from text that you provide. The clouds give greater prominence to words that appear more frequently in the source text. You can tweak your clouds with different fonts, layouts, and color schemes. The images you create with Wordle are yours to use however you like. You can print them out, or save them to the Wordle gallery to share with your friends.</em></p>
</blockquote>
<p>But since (often) a picture says&nbsp; more than &hellip; See the following (small) image of what Wordle might do for you:</p>
<p><img style="margin-right: auto; margin-left: auto; float: none; display: block;" src="https://www.wordle.net/thumb/wrdl/4500593/What_Wordle_is" width="253" height="190" /></p>
<p>Now, Wordle may generate word clouds by poiting it to your word source or by posting a collection of "(frequency-weighted) words to the <a href="https://www.wordle.net/advanced">wordle site</a>. Consequently, this is what the following snippet is all about. It is based on the MSDN article &ldquo;<a href="https://msdn.microsoft.com/de-de/library/debx8sh9.aspx">How to: Send Data Using the WebRequest Class</a>&rdquo;. I followed the imperative blue print and did not use F# heavyweights like async.</p>
<div class="csharpcode">&nbsp;</div>
<div class="csharpcode">
<pre class="alt"><span class="lnum"> 1: </span>open System.Net</pre>
</div>
<div class="csharpcode"></div>
<div class="csharpcode">
<pre><span class="lnum"> 2: </span>&nbsp;</pre>
</div>
<div class="csharpcode"></div>
<div class="csharpcode">
<pre class="alt"><span class="lnum"> 3: </span>let words = <span class="str">""</span></pre>
</div>
<div class="csharpcode"></div>
<div class="csharpcode">
<pre><span class="lnum"> 4: </span>&nbsp;</pre>
</div>
<div class="csharpcode"></div>
<div class="csharpcode">
<pre class="alt"><span class="lnum"> 5: </span>let worddleUrl = <span class="str">"https://www.wordle.net/advanced"</span></pre>
</div>
<div class="csharpcode"></div>
<div class="csharpcode">
<pre><span class="lnum"> 6: </span>&nbsp;</pre>
</div>
<div class="csharpcode"></div>
<div class="csharpcode">
<pre class="alt"><span class="lnum"> 7: </span>let r = System.Net.WebRequest.Create(worddleUrl)</pre>
</div>
<div class="csharpcode"></div>
<div class="csharpcode">
<pre><span class="lnum"> 8: </span>r.Credentials &lt;- CredentialCache.DefaultCredentials</pre>
</div>
<div class="csharpcode"></div>
<div class="csharpcode">
<pre class="alt"><span class="lnum"> 9: </span>r.Method &lt;- <span class="str">"POST"</span></pre>
</div>
<div class="csharpcode"></div>
<div class="csharpcode">
<pre><span class="lnum"> 10: </span>r.ContentType &lt;- <span class="str">"application/x-www-form-urlencoded"</span></pre>
</div>
<div class="csharpcode"></div>
<div class="csharpcode">
<pre class="alt"><span class="lnum"> 11: </span>let s = r.GetRequestStream()</pre>
</div>
<div class="csharpcode"></div>
<div class="csharpcode">
<pre><span class="lnum"> 12: </span>let wordsEncoded = System.Text.Encoding.UTF8.GetBytes (<span class="str">"text="</span>+ words);</pre>
</div>
<div class="csharpcode"></div>
<div class="csharpcode">
<pre class="alt"><span class="lnum"> 13: </span>let wordsLen = ( Array.length wordsEncoded )</pre>
</div>
<div class="csharpcode"></div>
<div class="csharpcode">
<pre><span class="lnum"> 14: </span>s.Write(wordsEncoded, 0, wordsLen)</pre>
</div>
<div class="csharpcode"></div>
<div class="csharpcode">
<pre class="alt"><span class="lnum"> 15: </span>s.Close()</pre>
</div>
<div class="csharpcode"></div>
<div class="csharpcode">
<pre><span class="lnum"> 16: </span>&nbsp;</pre>
</div>
<div class="csharpcode"></div>
<div class="csharpcode">
<pre class="alt"><span class="lnum"> 17: </span>let response = r.GetResponse()</pre>
</div>
<div class="csharpcode"></div>
<div class="csharpcode">
<pre><span class="lnum"> 18: </span>let responseStream = response.GetResponseStream()</pre>
</div>
<div class="csharpcode"></div>
<div class="csharpcode">
<pre class="alt"><span class="lnum"> 19: </span><span class="kwrd">using</span> ( <span class="kwrd">new</span> System.IO.StreamReader(responseStream)) (fun sr -&gt;</pre>
</div>
<div class="csharpcode"></div>
<div class="csharpcode">
<pre><span class="lnum"> 20: </span>  let responseText = sr.ReadToEnd()</pre>
</div>
<div class="csharpcode"></div>
<div class="csharpcode">
<pre class="alt"><span class="lnum"> 21: </span>  <span class="kwrd">using</span> (System.IO.File.CreateText(<span class="str">"/response.htm"</span>)) (fun wr -&gt;</pre>
</div>
<div class="csharpcode"></div>
<div class="csharpcode">
<pre><span class="lnum"> 22: </span>    wr.Write(responseText)</pre>
</div>
<div class="csharpcode"></div>
<div class="csharpcode">
<pre class="alt"><span class="lnum"> 23: </span>  )</pre>
</div>
<div class="csharpcode"></div>
<div class="csharpcode">
<pre><span class="lnum"> 24: </span>)</pre>
</div>
<div class="csharpcode"></div>
<p>&nbsp;</p>
<p>The code is quite simple, supply space-delimited words in the words variable (e.g., "hello world&rdquo;) or you might even use frequency-weighted words using the syntax &ldquo;word:frequency&rdquo; where frequency is a natural number like 3. The rest of the code follows the mentioned MSDN sample, i.e. using a WebRequest to contact the Wordle service, waiting for a response and writing the response to a local html file. Now, you might have expected that the result from a Wordle call is an image representation of a word cloud. This is not the case, instead what you get is an HTML with the Wordle Java applet, which when started will actually render your word cloud. Now, what you get is a &ldquo;suggestion&rdquo; or one version to render your words as a word cloud. However, the applet provides some level of customisability, i.e. changing word-placement strategy, color, font, etc. Lastly, you might want to print your word cloud, for example, as a pdf. Unfortunately, <a href="https://www.wordle.net/faq#bigger">you cannot export the word cloud into an image container</a> but you may use a screen-shotting device to achieve a similar result.</p>
<p>With that happy word clouding with the excellent Wordle.</p>]]></content:encoded>
    </item>
    <item>
      <title>MSR-puts the fun in Software Engineering</title>
      <link>https://docs.microsoft.com/archive/blogs/christianb/msr-puts-the-fun-in-software-engineering</link>
      <pubDate>Sat, 13 Aug 2011 12:00:04 GMT</pubDate>
      <dc:creator><![CDATA[cbitter]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/christianb/2011/08/13/msr-puts-the-fun-in-software-engineering/</guid>
      <description><![CDATA[Some time ago, Microsoft Research (MSR) made Pex (a white-box testing tool) universally available in...]]></description>
      <content:encoded><![CDATA[<p>Some time ago, Microsoft Research (MSR) made Pex (a white-box testing tool) universally available in the form of a web challenge, called <a href="https://www.pexforfun.com/" target="_blank">Pex for fun</a>. Pex for fun followed the great example Project Euler, striving to build a challenge-oriented community while allowing “players” to familiarize themselves with the basics of Pex.</p>  <p>Now, MSR and more specifically the Research in Software Engineering Team (RiSE) of MSR made some of the known (and some of the lesser known ones) applications and libraries available in the same convenient, easily accessible Pex style, i.e. via a web interface.</p>  <p>Just head over to <a href="https://rise4fun.com" target="_blank">RiSE4fun</a> and try your favorites: pex, rex, spec# or z3. The site has a twitter-like real-time feed called <a href="https://rise4fun.com/live" target="_blank">live</a> and more importantly supports a <a href="https://rise4fun.com/rest/help" target="_blank">REST API</a>. Using this API you may, much like Pex which already exists on Windows Phone 7, build your WP7 variant of a RiSE app or you may use a RiSE tool like the <a href="https://nlp.stanford.edu:8080/parser/" target="_blank">Stanford Parser</a> - online.</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/28/94/metablogapi/4174.Capture_687A9A94.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-28-94-metablogapi/4174.Capture_5F00_687A9A94.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px; padding-top: 0px" title="Capture" border="0" alt="Capture" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/28/94/metablogapi/3005.Capture_thumb_0F190115.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-28-94-metablogapi/3005.Capture_5F00_thumb_5F00_0F190115.png" width="582" height="127" /></a></p>  <p>With that, enjoy and put the fun in exploring RiSE4fun.</p>]]></content:encoded>
    </item>
    <item>
      <title>Powershell–Query Disk Space</title>
      <link>https://docs.microsoft.com/archive/blogs/christianb/powershellquery-disk-space</link>
      <pubDate>Wed, 10 Aug 2011 10:15:20 GMT</pubDate>
      <dc:creator><![CDATA[cbitter]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/christianb/2011/08/10/powershellquery-disk-space/</guid>
      <description><![CDATA[Today’s post is the advertisement of a simple script, which uses Powershell and WMI to query the...]]></description>
      <content:encoded><![CDATA[<p>Today’s post is the advertisement of a simple script, which uses Powershell and WMI to query the disks and their usage of some machine(s). Furthermore, the script allows you to query a comma-separated list of hosts by name, set a usage treshold and some html file used to display the results.</p>  <p>For example, the following output (html file) was obtained by querying my own machine:</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/28/94/metablogapi/6813.Capture_62184B2D.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-28-94-metablogapi/6813.Capture_5F00_62184B2D.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="Capture" border="0" alt="Capture" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/28/94/metablogapi/8463.Capture_thumb_2BC7231E.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-28-94-metablogapi/8463.Capture_5F00_thumb_5F00_2BC7231E.png" width="570" height="84" /></a></p>  <p>As mentioned, the script itself uses simple Powershell techniques like WMI, html and csv handling. Beware that actual script comments and output is in German. Invoking the script is a simple matter, since default arguments are provided.</p>  <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">   <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet">     <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> #param:</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> #    machineName     - einzelner Rechnername, oder kommaseparierte List von Rechnern =&gt; X oder X,Y</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span> #    usageTreshold    - Wert zwischen 0 und 1, Schwellwert für Auslastung des Festplattenspeichers <span style="color: #0000ff">in</span> %</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span> #    htmlFile        - HTML Datei, die zur Dokumentation eingesetzt werden kann</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span>  </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span> param(</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span>     [<span style="color: #0000ff">string</span>]$machineName = <span style="color: #006080">&quot;NONE&quot;</span>,</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span>     [<span style="color: #0000ff">float</span>]$usageTreshold = 0.11,</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9">   9:</span>     [<span style="color: #0000ff">string</span>]$htmlFile = <span style="color: #006080">&quot;C:\environment.html&quot;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum10">  10:</span> );</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum11">  11:</span>  </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum12">  12:</span> function CheckParam(){</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum13">  13:</span>     <span style="color: #0000ff">if</span> ([System.String]::IsNullOrEmpty($machineName) -eq $<span style="color: #0000ff">true</span>) { <span style="color: #0000ff">throw</span> <span style="color: #006080">&quot;Rechnername darf nicht null oder leer sein!&quot;</span> ; }</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum14">  14:</span> }</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum15">  15:</span>  </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum16">  16:</span> function GetSpaceOnMachine([<span style="color: #0000ff">string</span>]$machine, [<span style="color: #0000ff">ref</span>]$HTMLRepository) {</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum17">  17:</span>     write-host <span style="color: #006080">&quot;WMI - GetSpace on `&quot;</span>$machine`<span style="color: #006080">&quot; ... &quot;</span> -foregroundcolor gray; </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum18">  18:</span>     $<span style="color: #0000ff">private</span>:message = <span style="color: #006080">&quot;&quot;</span>;</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum19">  19:</span>     $<span style="color: #0000ff">private</span>:MBFrac = 0.00000095367431640625 ; </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum20">  20:</span>     </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum21">  21:</span>     (get-wmiobject win32_logicaldisk -<span style="color: #0000ff">namespace</span> <span style="color: #006080">&quot;root\cimv2&quot;</span> -computername <span style="color: #006080">&quot;$machine&quot;</span> ) | ? { $_.DriveType -eq 3 ; } | % {</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum22">  22:</span>     </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum23">  23:</span>         $<span style="color: #0000ff">private</span>:name = $_.Name;</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum24">  24:</span>         $<span style="color: #0000ff">private</span>:size = $_.Size;</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum25">  25:</span>         $<span style="color: #0000ff">private</span>:unused = $_.FreeSpace;</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum26">  26:</span>         $<span style="color: #0000ff">private</span>:sizeMB = [System.Math]::Round($size * $MBFrac);</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum27">  27:</span>         $<span style="color: #0000ff">private</span>:unusedMB = [System.Math]::Round($unused * $MBFrac);</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum28">  28:</span>          </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum29">  29:</span>         $<span style="color: #0000ff">private</span>:usage = [<span style="color: #0000ff">double</span>]$unused / [<span style="color: #0000ff">double</span>]$size ;</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum30">  30:</span>         $<span style="color: #0000ff">private</span>:usagePercent = [System.Math]::Round($usage * 100.0);</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum31">  31:</span>         <span style="color: #0000ff">if</span> ($usage -lt $usageTreshold) {</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum32">  32:</span>             $message = <span style="color: #006080">&quot;Festplatte $name auf $machine ... weniger als $usagePercent% frei ($unusedMB MB von $sizeMB MB frei) !&quot;</span> ; </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum33">  33:</span>             write-host $message -foregroundcolor red ;</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum34">  34:</span>         }</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum35">  35:</span>         <span style="color: #0000ff">else</span> {</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum36">  36:</span>             $message = <span style="color: #006080">&quot;Festplatte $name auf $machine ... mehr als $usagePercent% frei ($unusedMB MB von $sizeMB MB frei) !&quot;</span> ;</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum37">  37:</span>             write-host $message -foregroundcolor green ; </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum38">  38:</span>         }</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum39">  39:</span>         </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum40">  40:</span>         $HTMLRepository.Value.Add( ($machine + <span style="color: #006080">&quot; (&quot;</span> + $name + <span style="color: #006080">&quot;)&quot;</span> ), $message);</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum41">  41:</span>     }    </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum42">  42:</span> }</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum43">  43:</span>  </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum44">  44:</span> function Main(){</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum45">  45:</span>     cls ;</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum46">  46:</span>     </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum47">  47:</span>     CheckParam ;</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum48">  48:</span>     </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum49">  49:</span>     <span style="color: #0000ff">if</span> ( ($machineName.ToUpperInvariant() -eq <span style="color: #006080">'NONE'</span>) -eq $<span style="color: #0000ff">true</span>) {</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum50">  50:</span>         write-host <span style="color: #006080">&quot;Rechnername `&quot;</span>NONE`<span style="color: #006080">&quot; wird auf hostname gesetzt ... &quot;</span>; </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum51">  51:</span>         </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum52">  52:</span>         $machineName = hostname ;</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum53">  53:</span>     }</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum54">  54:</span>     </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum55">  55:</span>     [hashtable]$<span style="color: #0000ff">private</span>:HTMLRepository = @{};</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum56">  56:</span>     </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum57">  57:</span>     <span style="color: #0000ff">if</span> ( $machineName.Contains(<span style="color: #006080">&quot;,&quot;</span>) -eq $<span style="color: #0000ff">true</span> ) {</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum58">  58:</span>         write-host <span style="color: #006080">&quot;Collection von Rechnern wird abgefragt ... &quot;</span> -foregroundcolor white ;</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum59">  59:</span>         </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum60">  60:</span>         ([System.Text.RegularExpressions.Regex]::Split($machineName, <span style="color: #006080">&quot;,&quot;</span>) ) | % {</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum61">  61:</span>             GetSpaceOnMachine $_ ([<span style="color: #0000ff">ref</span>]$HTMLRepository);</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum62">  62:</span>         }</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum63">  63:</span>     }</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum64">  64:</span>     <span style="color: #0000ff">else</span> {    GetSpaceOnMachine $machineName ([<span style="color: #0000ff">ref</span>]$HTMLRepository) ;  }</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum65">  65:</span>     </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum66">  66:</span>     <span style="color: #0000ff">if</span> ( [System.String]::IsNullOrEmpty($htmlFile) -eq $<span style="color: #0000ff">false</span> ) {</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum67">  67:</span>     </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum68">  68:</span>         <span style="color: #0000ff">if</span> ( (test-path $htmlFile) -eq $<span style="color: #0000ff">true</span> ) { del $htmlFile -force ; }</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum69">  69:</span>     </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum70">  70:</span>         write-host <span style="color: #006080">&quot;Exportiere Ergebnis in HTML Datei ... &quot;</span> ; </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum71">  71:</span>         add-content (<span style="color: #006080">&quot;`&quot;</span>Rechner (Festplatte)`<span style="color: #006080">&quot;, `&quot;</span>Status (<span style="color: #006080">&quot; + [System.DateTime]::Now + &quot;</span>)`<span style="color: #006080">&quot;&quot;</span>) -path <span style="color: #006080">&quot;C:\temp.csv&quot;</span> ; </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum72">  72:</span>         $HTMLRepository.Keys  | % { </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum73">  73:</span>             $<span style="color: #0000ff">private</span>:val = $HTMLRepository[$_];</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum74">  74:</span>             $<span style="color: #0000ff">private</span>:key = $_ ; </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum75">  75:</span>             add-content <span style="color: #006080">&quot;`&quot;</span>$key`<span style="color: #006080">&quot;, `&quot;</span>$val`<span style="color: #006080">&quot; &quot;</span> -path <span style="color: #006080">&quot;C:\temp.csv&quot;</span> ; </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum76">  76:</span>         }</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum77">  77:</span>         import-csv <span style="color: #006080">&quot;C:\temp.csv&quot;</span> | convertto-html -title (<span style="color: #006080">&quot;Freier Festplattenplatz in Umgebung (&quot;</span> + [System.DateTime]::Now + <span style="color: #006080">&quot;)&quot;</span> )  &gt; $htmlFile ;</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum78">  78:</span>         </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum79">  79:</span>         $x = (get-content $htmlFile)</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum80">  80:</span>         del -force $htmlFile ;</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum81">  81:</span>         $x | % { $_ -replace <span style="color: #006080">&quot;&lt;/head&gt;&quot;</span>, <span style="color: #006080">&quot;&lt;style type=`&quot;</span>text/css`<span style="color: #006080">&quot;&gt; td { text-align:left; border:1px solid #000; vertical-align:top; overflow:hidden; } th { background-color: black; color: white; text-align:left; } table { width:100%; }&lt;/style&gt;&lt;/head&gt;&quot;</span> } | add-content $htmlFile ;</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum82">  82:</span>     </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum83">  83:</span>         </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum84">  84:</span>         del <span style="color: #006080">&quot;C:\temp.csv&quot;</span> ;</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum85">  85:</span>     }</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum86">  86:</span> }</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum87">  87:</span>  </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum88">  88:</span> Main ;</pre>
<!--CRLF--></div>
</div>]]></content:encoded>
    </item>
    <item>
      <title>Adventures towards F# readability</title>
      <link>https://docs.microsoft.com/archive/blogs/christianb/adventures-towards-f-readability</link>
      <pubDate>Thu, 14 Jul 2011 11:32:37 GMT</pubDate>
      <dc:creator><![CDATA[cbitter]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/christianb/2011/07/14/adventures-towards-f-readability/</guid>
      <description><![CDATA[Influenced by the sheer beauty of F# and the practicality of FsUnit, I decided to approach the...]]></description>
      <content:encoded><![CDATA[<p>Influenced by the sheer beauty of F# and the practicality of FsUnit, I decided to approach the concept of F# readability and more domain-oriented programming. For that I decided to program a small snippet, which pushes some element onto a stack of elements. However, instead of going with the usual, such as calling a function. which would eventually read like</p>  <pre>pushOnto(elem, stack)</pre>

<p>I opted for something more readable. Luckily, hjgher order F# functions, i.e. functions that take parameters, which are themselves functions, come to the rescue, As you may see, from the snippet below:</p>

<pre class="code"><span style="color: blue">module </span>Test

<span style="color: blue">let </span>onto s = s

<span style="color: blue">type </span>'a Stack = 'a List

<span style="color: blue">let </span>EmptyStack = List.empty

<span style="color: blue">let </span>push a (ontostack:'a list <span style="color: blue">-&gt; </span>'a list) (st:'a list) =
    <span style="color: blue">let </span>pushx stack elem = 
        elem::stack
    pushx (ontostack st) a

<span style="color: blue">let mutable </span>myStack = EmptyStack

myStack &lt;- push <span style="color: maroon">'L' </span>onto myStack 
myStack &lt;- push <span style="color: maroon">'O' </span>onto myStack 
myStack &lt;- push <span style="color: maroon">'O' </span>onto myStack 
myStack &lt;- push <span style="color: maroon">'C' </span>onto myStack 

printfn <span style="color: maroon">&quot;%A&quot; </span>myStack

printfn <span style="color: maroon">&quot;press &lt;any&gt; key to exit&quot;
</span>System.Console.ReadLine() |&gt; ignore</pre>

<pre class="code"><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/28/94/metablogapi/3223.Capture_15B5675F.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-28-94-metablogapi/3223.Capture_5F00_15B5675F.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="Capture" border="0" alt="Capture" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/28/94/metablogapi/0576.Capture_thumb_2F38E08D.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-28-94-metablogapi/0576.Capture_5F00_thumb_5F00_2F38E08D.png" width="364" height="92" /></a></pre>

<p>A call sequence like <font face="Consolas"><strong>push &lt;Element&gt; onto &lt;Stack&gt;</strong></font></p>

<p>reads much more natural than the function call presented above, or a variant like:</p>

<pre>elem |&gt; push stack</pre>

<p>Clearly, the stack example is trivial, but imagine cases like the ones covered by FsUnit or applications to scientific or any domain-specific computing. Instead of letting the technicality of the implementation language shine through, domain-specific concepts and abstractions can be implemented to such a degree that domain-savy experts my (unknowingly) use F# to solve complex business problems.</p>

<p>With that … read you later.</p>]]></content:encoded>
    </item>
    <item>
      <title>Some things to check out</title>
      <link>https://docs.microsoft.com/archive/blogs/christianb/some-things-to-check-out</link>
      <pubDate>Fri, 01 Jul 2011 12:41:39 GMT</pubDate>
      <dc:creator><![CDATA[cbitter]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/christianb/2011/07/01/some-things-to-check-out/</guid>
      <description><![CDATA[&#160;  Today’s post is merely a link dump, of things I found while digging through my rss archive:...]]></description>
      <content:encoded><![CDATA[<p>&#160;</p>  <p>Today’s post is merely a link dump, of things I found while digging through <a href="https://www.google.com/reader/shared/Christian.Bitter" target="_blank">my rss archive</a>:</p>  <ol>   <li><a href="https://lyncguistic.cloudapp.net/" target="_blank">Lync Conversation Translator</a>      <br />      <br />Lync-Guistic, also known as <em>Microsoft Lync 2010 Conversation Translator</em>, allows you to send and receive instant messages with Microsoft Lync using the Microsoft Bing translation service. Bilingual users can provide translation feedback to help improve the service.      <br /></li>    <li><a href="https://msdn.microsoft.com/en-us/devlabs/hh227299" target="_blank">Dev Labs: Debugger Canvas</a>:      <br />Debugger Canvas is a new user experience for the debugger in Visual Studio Ultimate. It pulls together the code you’re exploring onto a single pan-and-zoom display. As you hit breakpoints or step into code, Debugger Canvas shows just the methods that you’re debugging, with call lines and local variables, to help you see the bigger picture.      <br />      <br /></li>    <li><a href="https://research.microsoft.com/en-us/news/features/mobisys2011-062811.aspx" target="_blank">Multiplayer Gaming for Smartphones</a>:      <br />      <br />Gaming on a smartphone comes with compromises, though. Most smartphone-based games are single-player games—<i>Angry Birds</i> is a perfect example—or turn-based, in which two or more players queue up on a single phone to play games.</li>    <p>Bahl and a team of Microsoft Research scientists and interns created Switchboard, a cloud service that enables smartphones to link to each other for multiplayer gaming. Joining Bahl on the project were Justin Manweiler, an intern, and Romit Roy Choudhury, a visiting researcher, both from Duke University; and <a href="https://research.microsoft.com/en-us/people/sagarwal/">Sharad Agarwal</a> and <a href="https://research.microsoft.com/en-us/people/mzh/">Ming Zhang</a>from Microsoft Research Redmond. Agarwal was the project leader for Switchboard.</p> </ol>  <p>Happy reading, lyncing or debugging.</p>]]></content:encoded>
    </item>
    <item>
      <title>A Porter Stemmer in F#</title>
      <link>https://docs.microsoft.com/archive/blogs/christianb/a-porter-stemmer-in-f</link>
      <pubDate>Fri, 24 Jun 2011 07:56:14 GMT</pubDate>
      <dc:creator><![CDATA[cbitter]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/christianb/2011/06/24/a-porter-stemmer-in-f/</guid>
      <description><![CDATA[&#160;  Citing from the introduction to Martin Porter’s work [1]:     Removing suffixes by automatic...]]></description>
      <content:encoded><![CDATA[<p>&#160;</p>  <p>Citing from the introduction to Martin Porter’s work [1]:</p>  <blockquote>   <pre>Removing suffixes by automatic means is an operation which is especially
useful in the field of information retrieval.</pre>
</blockquote>

<p>Consequently, a stemmer is a (software) program to reduce inflected words to their root form (word stem). To derive a word’s root form a stemming program uses stemming algorithm(s). For example, a stemming algorithm might reduce the word catering to the stem cater. Notice, that different words may be reduced to the same stem, because they may be rooted in the same origin.</p>

<p>Potential stemming algorithms include dictionary-based approaches, i.e. looking up a word’s stem, or rule- and stochastic-based approaches [2]. Among the many stemming approaches, Porter’s variant is probably among of the most known ones. Reasons for this may be its availability in documentation and implementation format, and it’s natural appeal, i.e. one can immediately understand what the stemmer does by following Porter’s rules and provided examples.</p>

<p>For example, a rule dictates that any English word, which ends in “SSES” should be contracted to “SS”, i.e. the suffix commonly indicating plural, should be removed. Porter gives a handful of rules (30 or so) nicely arranged in a pipeline processing scheme, i.e. some rules are executed in a batch (named step) whenever the rules pre-condition is matched. Broadly there are 5 different steps, taking care of for example, plural, participle and noun suffixes.</p>

<p>Rule conditions govern whether or not a rule should be executed on some word(-fragment). Rules include:</p>

<ul>
  <li>Does a word contain vowels </li>

  <li>Does a word end with a certain double consonant </li>

  <li>Does a word end with a particular suffix </li>

  <li>Does a word contain a sequence of vowel and consonant of length l </li>
</ul>

<p>Whenever a rule is executed it either leads to a word contraction (removing a suffix), composition with an additional “e” or substitution of word parts (letters).</p>

<p>Equipped with this knowledge, I followed Porter’s paper and implemented the basic Porter stemming algorithm in F#. Since Porter did not only give the basic algorithm (rules), but also tests for it, I used a method resembling test-driven development to implement the stemmer. That is, using <a href="https://fsunit.codeplex.com/" target="_blank">FsUnit</a>, I implemented rule tests like:</p>

<pre class="code"><span style="color: maroon">&quot;caresses&quot; </span>|&gt; porterStem |&gt; should equal <span style="color: maroon">&quot;caress&quot;
</span></pre>

<p>to drive implementation. Clearly, in the beginning, such a test expecting the word “caresses” to be stemmed to the stem “caress”, would fail. However, after having implemented step 1 (the previously mentioned batch of processing rules) given by Porter the stemmer would pass the test. Following this methodology, I implemented each step after I took and coded Porter’s tests for that step. Since tests are localised, i.e. a test tests a particular rule or batch of rules, tests might interfere with one another, i.e. produce some result deemed incorrect by a test but perfectly correct with regard to the implementation.</p>

<p>The F# implementation makes use of pattern matching, active patterns and pipelining. For example, avoiding the actual implementation of steps at the moment, the stemming process a word goes through is defined by:</p>

<pre class="code"><font size="1" face="Consolas">word
|&gt; step1A 
|&gt; step1B
|&gt; step1C
|&gt; step2
|&gt; step3
|&gt; step4
|&gt; step5A
|&gt; step5B</font></pre>

<p>Here, a word is simply a sequence of letters, which can be either consonant or vowel:</p>

<pre class="code"><font face="Consolas"><font size="1"><span style="color: blue">type </span>Symbol = char
</font></font><font face="Consolas"><font size="1"><span style="color: green">///&lt;Summary&gt;
///defines a letter, which can be the empty letter
///or a vowel (Vow) or a consonant (Cons)
///&lt;/Summary&gt;
</span><span style="color: blue">type </span>Letter = 
    | EmptyLetter
    | Vow <span style="color: blue">of </span>Symbol
    | Cons <span style="color: blue">of </span>Symbol

<span style="color: blue">let </span>isVowel (v:Symbol) = 
    v = <span style="color: maroon">'a' </span>|| v = <span style="color: maroon">'A' </span>|| 
    v = <span style="color: maroon">'e' </span>|| v = <span style="color: maroon">'E' </span>|| 
    v = <span style="color: maroon">'i' </span>|| v = <span style="color: maroon">'I' </span>|| 
    v = <span style="color: maroon">'o' </span>|| v = <span style="color: maroon">'O' </span>|| 
    v = <span style="color: maroon">'u' </span>|| v = </font></font><font face="Consolas"><font size="1"><span style="color: maroon">'U'

</span><span style="color: blue">let </span>(|Consonant|Vowel|) (s:Symbol) = 
    <span style="color: blue">match </span>isVowel(s) </font></font><font face="Consolas"><font size="1"><span style="color: blue">with
    </span>| <span style="color: blue">true -&gt; </span>Vowel(s)
    | <span style="color: blue">false -&gt; </span>Consonant(s)</font></font></pre>

<p>Since the actual implementation is rather large, you may find the stemmers implementation on <a href="https://skydrive.live.com/redir.aspx?cid=aecaa12b1d66e6ec&amp;resid=AECAA12B1D66E6EC!237" target="_blank">SkyDrive</a>. I created a folder specifically for my F# explorations. Notice, that this is not a full-blown project but rather a dump for (F#) source files. As such, I do not take responsibility for correctness, while I may answer question, the code is free – in lieu of <a href="https://tartarus.org/~martin/PorterStemmer/" target="_blank">Porters FAQ statement</a>.</p>

<p>In order to compile the stemmer, simply create a standard F# project. In order to run the tests, you need <a href="https://www.nunit.org/" target="_blank">NUnit</a> as advised for FsUnit. The F# project was created using Visual Studio 2010 and F# 2.0. I zipped up all necessary files, including:</p>

<ul>
  <li>The stemmer’s implementation </li>

  <li>The tests </li>

  <li>FsUnit </li>

  <li>The research paper in txt form (see References) </li>

  <li>A todo list </li>
</ul>

<p>With that, happy stemming and read you soon.</p>

<p><a href="https://skydrive.live.com/redir.aspx?cid=aecaa12b1d66e6ec&amp;resid=AECAA12B1D66E6EC!237" target="_blank">F# Porter Stemmer SkyDrive link</a></p>

<p>Update:</p>

<ul>
  <li><strong>2011-06-25 (v0.2)</strong>: bug fixing and additional rules specified by Porter</li>
</ul>

<p>Todo:</p>

<ul>
  <li>Optimisations already given by Porter</li>

  <li>Documentation</li>

  <li>F#isation</li>
</ul>

<p><strong><u>References</u></strong></p>

<ol>
  <li><strong><u><a href="https://tartarus.org/~martin/PorterStemmer/def.txt" target="_blank">M.F.Porter (1980): An Algorithm for suffix stripping</a></u></strong> </li>

  <li><strong><u><a href="https://en.wikipedia.org/wiki/Stemming" target="_blank">Wikipedia: Stemming</a></u></strong> </li>
</ol>]]></content:encoded>
    </item>
    <item>
      <title>F#-Querying WordNet Online</title>
      <link>https://docs.microsoft.com/archive/blogs/christianb/f-querying-wordnet-online</link>
      <pubDate>Fri, 10 Jun 2011 03:07:33 GMT</pubDate>
      <dc:creator><![CDATA[cbitter]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/christianb/2011/06/10/f-querying-wordnet-online/</guid>
      <description><![CDATA[&#160;  Todays post focuses on using F# to query Princeton’s WordNet Online service for information...]]></description>
      <content:encoded><![CDATA[<p>&#160;</p>  <p>Todays post focuses on using F# to query <a href="https://wordnetweb.princeton.edu/perl/webwn" target="_blank">Princeton’s WordNet Online service</a> for information about some word. According to WordNet’s home:</p>  <blockquote>   <p>WordNet® is a large lexical database of English. Nouns, verbs, adjectives and adverbs are grouped into sets of cognitive synonyms (synsets), each expressing a distinct concept. Synsets are interlinked by means of conceptual-semantic and lexical relations. The resulting network of meaningfully related words and concepts can be navigated with the <a href="https://wordnetweb.princeton.edu/perl/webwn">browser</a>. WordNet is also freely and publicly available for <a href="https://wordnet.princeton.edu/wordnet/download/">download</a>. WordNet's structure makes it a useful tool for computational linguistics and natural language processing.</p> </blockquote>  <p>Traditionally, WordNet could be accessed from <a href="https://wordnet.princeton.edu/wordnet/related-projects/" target="_blank">Prolog or via API abstractions of Prolog’s database database means</a>. However, (more or less) recently the ability to query WordNet online was provided. Since I am aiming at gaining confidence with F#, I tried to make the wonderful world of SynSet approachable via F#.</p>  <p>In order to use WordNet Online there will be the following steps:</p>  <ol>   <li>Initialize and query user about what word she wants to ask WordNet </li>    <li>Ask WordNet about the user word </li>    <li>Process WordNet’s answer </li> </ol>  <p>In order to realise points 1 – 3, we’ll develop a F# console application, which reads the console to obtain a word, make a web request to WordNet online to ask about the word’s SynSets. The result will be a HTML page, which will be processed using the <a href="https://htmlagilitypack.codeplex.com/" target="_blank">HTMLAgilityPack</a>, which is a CodePlex hosted project, with the following purpose:</p>  <blockquote>   <p>This is an agile HTML parser that builds a read/write DOM and supports plain XPATH or XSLT (you actually don't HAVE to understand XPATH nor XSLT to use it, don't worry...). It is a .NET code library that allows you to parse &quot;out of the web&quot; HTML files. The parser is very tolerant with &quot;real world&quot; malformed HTML. The object model is very similar to what proposes System.Xml, but for HTML documents (or streams).</p> </blockquote>  <p>Within the realm of html parsing, we’ll use F# pattern and regular expression matching. Notice that, this is merely a prototypical solution and as such, many improvements can potentially be made to it, including:</p>  <ul>   <li><strong>Stability and Robustness</strong>       <br />I do not claim, that the solution handles all WordNet answers correctly. I will do some more testing and tweaking but for now, it seams to work. </li>    <li><strong>Performance</strong>       <br />I implemented a synchronous pipeline model. So you might take more advantage of asynchronous workflows. </li>    <li><strong>Completeness        <br /></strong>There are part of speech (adverb) which are currently not handled, by I intent to add those. </li>    <li><strong>Understandability</strong>       <br />I tried to stay within the F# idioms but, I assume some processing still bears imperative looks. </li> </ul>  <p>Now, to give you a feel, for what I intent to do, the following is a picture of WordNet Online being asked about the word “dog”.</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/28/94/metablogapi/2234.WordNet_3FC1470B.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-28-94-metablogapi/2234.WordNet_5F00_3FC1470B.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="WordNet" border="0" alt="WordNet" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/28/94/metablogapi/6740.WordNet_thumb_5985576D.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-28-94-metablogapi/6740.WordNet_5F00_thumb_5F00_5985576D.png" width="482" height="244" /></a></p>  <p>What I intent to do is to represent this information using an object SynSet having a SynType (its part of speech) like noun, etc. associated example sentences, and so on. Also, as you can see, WordNet Online allows us to specify certain query options, such as whether or not we want to be shown example sentences (e.g., “the dog barked all night”). Clearly, representing option information will be helpful too. For that, I defined the following types and some pattern match expression within their own module <font size="1" face="Consolas">FWordNetTypes</font>.</p>  <pre class="code"><font face="Consolas"><font size="1"><span style="color: blue">module </span>FWordNetTypes

<span style="color: blue">open </span>System.Text
<span style="color: blue">open </span>System.Text.RegularExpressions

<span style="color: blue">open </span>HtmlAgilityPack

<span style="color: blue">type </span>WordNetOptions = 
    { 
        ShowExampleSentences:bool;
        ShowGlosses:bool;
        ShowFrequencyCounts:bool;
        ShowDatabaseLocations:bool;
        ShowLexicalFileInfo:bool;
        ShowLexicalFileNumbers:bool;
        ShowSenseKeys:bool; 
        ShowSenseNumbers:bool
    }
    <span style="color: blue">member </span>this.BuildWordNetOptionsString() = 
        <span style="color: blue">let </span>optionString o = ( <span style="color: blue">if </span>o = <span style="color: blue">true then </span><span style="color: maroon">&quot;1&quot; </span><span style="color: blue">else </span>System.String.Empty )
        <span style="color: blue">let </span>x = ref ( StringBuilder() )
        x := (!x).Append(
            System.String.Format(</font></font><font face="Consolas"><font size="1"><span style="color: maroon">&quot;o0={0}&amp;o1={1}&amp;o2={2}&amp;o3={3}&amp;o4={4}&amp;o5={5}&amp;o6={6}&amp;o7={7}&amp;o8=1&quot;
                </span>, (optionString this.ShowExampleSentences)
                , (optionString this.ShowGlosses)
                , (optionString this.ShowFrequencyCounts)
                , (optionString this.ShowDatabaseLocations)
                , (optionString this.ShowLexicalFileInfo)
                , (optionString this.ShowLexicalFileNumbers)
                , (optionString this.ShowSenseKeys)
                , (optionString this.ShowSenseNumbers)
            )
        )
        (!x).ToString()

<span style="color: blue">type </span>SynType =
    | SynNoun
    | SynVerb
    | SynAdjective 
    | SynNone

<span style="color: blue">type </span>SynSetWord = 
    { 
        Word:string; 
        SenseKey:string; 
        SenseNumber:string
    }
    <span style="color: blue">override </span>this.ToString() = 
        this.Word + <span style="color: maroon">&quot;#&quot; </span>+ this.SenseNumber + <span style="color: maroon">&quot;(&quot;  </span>+ this.SenseKey + </font></font><font face="Consolas"><font size="1"><span style="color: maroon">&quot;)&quot;

</span><span style="color: blue">let </span>SynTypeToString s =
    <span style="color: blue">match </span>s </font></font><font face="Consolas"><font size="1"><span style="color: blue">with
        </span>| SynNoun <span style="color: blue">-&gt; </span></font></font><font face="Consolas"><font size="1"><span style="color: maroon">&quot;Noun&quot;
        </span>| SynVerb <span style="color: blue">-&gt; </span></font></font><font face="Consolas"><font size="1"><span style="color: maroon">&quot;Verb&quot;
        </span>| SynAdjective <span style="color: blue">-&gt; </span></font></font><font face="Consolas"><font size="1"><span style="color: maroon">&quot;Adjective&quot;
        </span>| _ <span style="color: blue">-&gt; </span></font></font><font face="Consolas"><font size="1"><span style="color: maroon">&quot;None&quot; 

</span><span style="color: blue">type </span>SynSet = 
    { 
        SType:SynType; 
        LexicalFileInfo:string;
        LexicalFileNumber:string;
        SynWords:seq&lt;SynSetWord&gt;; 
        SynGlos:seq&lt;string&gt;; 
        SynExampleSentences:seq&lt;string&gt;; 
        FrequencyCount:int; 
        DatabaseLocation:string; 
    }
    <span style="color: blue">override </span>this.ToString() = 
        <span style="color: blue">let </span>sb = ref (StringBuilder())
        sb := (!sb).Append(<span style="color: maroon">&quot;SynType          : &quot; </span>+ (SynTypeToString this.SType) + <span style="color: maroon">&quot;\r\n&quot;</span>)
        sb := (!sb).Append(<span style="color: maroon">&quot;SynWord(s)       :\r\n&quot;</span>)
        this.SynWords |&gt; Seq.iter(<span style="color: blue">fun </span>s <span style="color: blue">-&gt; </span>sb := (!sb).Append(<span style="color: maroon">&quot;[+]&quot; </span>+ s.ToString() + <span style="color: maroon">&quot;;\r\n&quot;</span>))

        sb := (!sb).Append(<span style="color: maroon">&quot;SynGlos:\r\n&quot;</span>)
        this.SynGlos |&gt; Seq.iter(<span style="color: blue">fun </span>s <span style="color: blue">-&gt; </span>sb := (!sb).Append(<span style="color: maroon">&quot;[+]&quot; </span>+ s + <span style="color: maroon">&quot;;\r\n&quot;</span>))
        
        sb := (!sb).Append(<span style="color: maroon">&quot;SynExample(s)    :\r\n&quot;</span>)
        this.SynExampleSentences |&gt; Seq.iter(<span style="color: blue">fun </span>s <span style="color: blue">-&gt; </span>sb := (!sb).Append(<span style="color: maroon">&quot;[+]&quot; </span>+ s + <span style="color: maroon">&quot;;\r\n&quot;</span>))

        sb := (!sb).Append(<span style="color: maroon">&quot;Frequency        : &quot; </span>+ this.FrequencyCount.ToString() + <span style="color: maroon">&quot;\r\n&quot;</span>)
        sb := (!sb).Append(<span style="color: maroon">&quot;DB Location      : &quot; </span>+ this.DatabaseLocation + <span style="color: maroon">&quot;\r\n&quot;</span>)
        sb := (!sb).Append(<span style="color: maroon">&quot;Lexical File Info: &quot; </span>+ this.LexicalFileInfo + <span style="color: maroon">&quot;\r\n&quot;</span>)
        sb := (!sb).Append(<span style="color: maroon">&quot;Lexical File No. : &quot; </span>+ this.LexicalFileNumber)

        (!sb).ToString()

<span style="color: blue">let </span>EmptySynSet = 
    { 
        SType = SynNone; 
        SynWords = Seq.empty ; 
        SynGlos = Seq.empty ; 
        SynExampleSentences = Seq.empty ; 
        FrequencyCount = -1; 
        DatabaseLocation = System.String.Empty; 
        LexicalFileInfo = System.String.Empty; 
        LexicalFileNumber = System.String.Empty; 
    }

<span style="color: blue">let </span>(|Noun|Verb|None|Adjective|) (v:string) =
    <span style="color: blue">match </span>v.ToLowerInvariant().Trim() </font></font><font face="Consolas"><font size="1"><span style="color: blue">with
        </span>| <span style="color: maroon">&quot;(n)&quot; </span><span style="color: blue">-&gt; </span>Noun
        | <span style="color: maroon">&quot;(v)&quot; </span><span style="color: blue">-&gt; </span>Verb
        | <span style="color: maroon">&quot;(adj)&quot; </span><span style="color: blue">-&gt; </span>Adjective
        | _ <span style="color: blue">-&gt; </span>None

<span style="color: blue">let </span>(|POS|SynWord|SynWordDesc|SynIndicator|SynExample|SynGlos|) (v:HtmlNode, word:string) =
    <span style="color: blue">if </span>(v.Name.ToLowerInvariant() = <span style="color: maroon">&quot;a&quot; </span>&amp;&amp; 
        v.Attributes.Contains(<span style="color: maroon">&quot;class&quot;</span>) &amp;&amp; 
        v.Attributes.Item(<span style="color: maroon">&quot;class&quot;</span>).Value.ToLowerInvariant() = <span style="color: maroon">&quot;pos&quot;</span>) </font></font><font face="Consolas"><font size="1"><span style="color: blue">then 
        </span>POS(v.InnerHtml.Trim())
    <span style="color: blue">elif </span>(v.Name.ToLowerInvariant() = <span style="color: maroon">&quot;b&quot; </span>|| 
         (v.InnerHtml.Contains(word) &amp;&amp; v.Name.ToLowerInvariant() &lt;&gt; <span style="color: maroon">&quot;i&quot; </span>) ) || 
         (
            v.Name.ToLowerInvariant() = <span style="color: maroon">&quot;a&quot; </span>&amp;&amp; 
            v.Attributes.Contains(<span style="color: maroon">&quot;href&quot;</span>) &amp;&amp; 
            v.InnerHtml.Contains(<span style="color: maroon">&quot;S:&quot;</span>) &lt;&gt; </font></font><font face="Consolas"><font size="1"><span style="color: blue">true
         </span>) </font></font><font face="Consolas"><font size="1"><span style="color: blue">then 
        let </span>processedInner = v.InnerHtml.Trim()
        <span style="color: blue">let </span>senseKeyNumberRegEx = Regex(<span style="color: maroon">&quot;(?&lt;SenseWord&gt;.+)\#(?&lt;SenseNumber&gt;\d+).*\((?&lt;SenseKey&gt;.*)\)&quot;</span>)
        <span style="color: blue">let </span>matches = senseKeyNumberRegEx.Match(processedInner)
        <span style="color: blue">if </span>matches.Success </font></font><font face="Consolas"><font size="1"><span style="color: blue">then
            let </span>senseWord  = matches.Groups.Item(<span style="color: maroon">&quot;SenseWord&quot;</span>).Value;
            <span style="color: blue">let </span>senseKey = matches.Groups.Item(<span style="color: maroon">&quot;SenseKey&quot;</span>).Value;
            <span style="color: blue">let </span>senseNumber = matches.Groups.Item(<span style="color: maroon">&quot;SenseNumber&quot;</span>).Value;
            
            SynWord( 
                { 
                    Word = senseWord; 
                    SenseKey = senseKey; 
                    SenseNumber = senseNumber; 
                }
            )
        </font></font><font face="Consolas"><font size="1"><span style="color: blue">else
            </span>SynWord( 
                { 
                    Word = processedInner ; 
                    SenseKey = System.String.Empty; 
                    SenseNumber = System.String.Empty; 
                } 
            )
    <span style="color: blue">elif </span>( v.Name.ToLowerInvariant() = <span style="color: maroon">&quot;a&quot; </span>&amp;&amp; 
           v.Attributes.Contains(<span style="color: maroon">&quot;href&quot;</span>) &amp;&amp; 
           v.InnerHtml.Contains(<span style="color: maroon">&quot;S:&quot;</span>)) </font></font><font face="Consolas"><font size="1"><span style="color: blue">then 
        </span>SynIndicator(v.InnerHtml.Trim())
    <span style="color: blue">elif </span>(v.Name.ToLowerInvariant() = <span style="color: maroon">&quot;i&quot; </span>&amp;&amp;
          v.InnerHtml.StartsWith(<span style="color: maroon">&quot;\&quot;&quot;</span>) &amp;&amp; 
          v.InnerHtml.EndsWith(<span style="color: maroon">&quot;\&quot;&quot;</span>)) </font></font><font face="Consolas"><font size="1"><span style="color: blue">then 
        </span>SynExample(v.InnerHtml.Trim())
    <span style="color: blue">elif </span>(v.InnerHtml.Trim().StartsWith(<span style="color: maroon">&quot;(&quot;</span>) &amp;&amp; 
          v.InnerHtml.Trim().EndsWith(<span style="color: maroon">&quot;)&quot;</span>) ) </font></font><font face="Consolas"><font size="1"><span style="color: blue">then 
        </span>SynGlos(v.InnerHtml.Replace(<span style="color: maroon">&quot;(&quot;</span>, <span style="color: maroon">&quot;&quot;</span>).Replace(<span style="color: maroon">&quot;)&quot;</span>, <span style="color: maroon">&quot;&quot;</span>).Trim())
    </font></font><font face="Consolas"><font size="1"><span style="color: blue">else 
        </span>SynWordDesc(v.InnerHtml.Trim())</font></font></pre>


<p>As you can see, WordNetOptions, SynSetWord and SynType are the main types to handle WordNet Online options, SynSets and words as part of a SynSet. The rest is F# patterns to make the parsing of WordNet HTML answers more intuitive and readable. For example, instead of dealing with strings of the form “(v)”, I want to be able to ask about part of speech. Or instead of decomposing the answer in terms of HTML nodes, I want to derive decision logic on the basis of words, glosses and example sentences, i.e. problem domain entities. As mentioned, I do not claim this to be the ideal solution, however, I want to stress the importance of decomposing a problem within the problem domain, which is more often than not more suitable then expressing it within the realm of technical terms.</p>

<p>Clearly, patterns abstracting HTML node patterns were even more powerful, i.e. instead of evaluating node names and attributes all over the place, why not have a pattern such as <font size="1" face="Consolas">BoldNode</font> or <font size="1" face="Consolas">AnchorNode</font>. I plan to incorporate this in the near term.</p>

<p>Equipped with the types, we want to fill via instantiation, we can decompose the problem flow into:</p>

<ol>
  <li>Get the user’s word from command-line </li>

  <li>Check whether the word is a word (not done here) and it is not a stop word, i.e. a word which has not entry in the WordNet database, because it does not express a concept, has no SynSet, etc. </li>

  <li>Set query options, such a retrieve example sentences or not </li>

  <li>Ask WordNet </li>

  <li>Process WordNet’s answer </li>

  <li>Display potential answer </li>
</ol>

<p>These 6 steps are shown in the following:</p>

<pre class="code"><font size="1" face="Consolas">WriteAsHeader </font><font face="Consolas"><font size="1"><span style="color: maroon">&quot;Ask WordNet ...&quot;

</span>printfn </font></font><font face="Consolas"><font size="1"><span style="color: maroon">&quot;enter a word: &quot;

</span><span style="color: blue">let </span>stopwords = [|<span style="color: maroon">&quot;a&quot;</span>; <span style="color: maroon">&quot;the&quot;</span>; <span style="color: maroon">&quot;these&quot;</span>; <span style="color: maroon">&quot;this&quot;</span>; <span style="color: maroon">&quot;those&quot;</span>; <span style="color: maroon">&quot;them&quot;</span>; <span style="color: maroon">&quot;their&quot; </span>|]
<span style="color: blue">let </span>isStopWord = 
    <span style="color: blue">fun </span>word </font></font><font face="Consolas"><font size="1"><span style="color: blue">-&gt; 
        </span>stopwords |&gt; Seq.exists(<span style="color: blue">fun </span>s <span style="color: blue">-&gt; </span>s.ToLowerInvariant() = word)

<span style="color: blue">let </span>word = System.Console.ReadLine().ToLowerInvariant()

<span style="color: blue">if </span>(isStopWord word) <span style="color: blue">then </span>printfn </font></font><font face="Consolas"><font size="1"><span style="color: maroon">&quot;word is a stop word ... exit&quot;
</span><span style="color: blue">elif </span>(System.String.IsNullOrEmpty(word)) <span style="color: blue">then </span>printfn </font></font><span style="color: maroon"><font size="1" face="Consolas">&quot;Cannot look for empty word ... exit&quot;
</font></span><font face="Consolas"><font size="1"><span style="color: blue">else 
    let </span>options = { 
        ShowExampleSentences    = <span style="color: blue">true</span>; 
        ShowGlosses             = <span style="color: blue">true</span>; 
        ShowFrequencyCounts     = <span style="color: blue">true</span>; 
        ShowDatabaseLocations   = <span style="color: blue">true</span>;
        ShowLexicalFileInfo     = <span style="color: blue">true</span>;
        ShowLexicalFileNumbers  = <span style="color: blue">true</span>;
        ShowSenseKeys           = <span style="color: blue">true</span>;
        ShowSenseNumbers        = <span style="color: blue">true</span>; 
    }
    <span style="color: blue">let </span>showErrors = </font></font><font face="Consolas"><font size="1"><span style="color: blue">false
    let </span>answer = askWordNet word options 
    <span style="color: blue">if </span>(System.String.IsNullOrEmpty(answer) &lt;&gt; <span style="color: blue">true</span>) </font></font><font face="Consolas"><font size="1"><span style="color: blue">then 
        </span>printfn </font></font><font face="Consolas"><font size="1"><span style="color: maroon">&quot;obtained answer from WordNet ...&quot;
        </span>answer |&gt; saveAnswerHTML word
        <span style="color: blue">let </span>processedAnswer = processWordNetAnswer word answer options showErrors
        <span style="color: blue">match </span>processedAnswer </font></font><font face="Consolas"><font size="1"><span style="color: blue">with 
            </span>| Some(answer)  </font></font><font face="Consolas"><font size="1"><span style="color: blue">-&gt;  
                </span>printfn </font></font><font face="Consolas"><font size="1"><span style="color: maroon">&quot;WordNet said ... :&quot;
                </span>answer  
                    |&gt; Seq.iter( <span style="color: blue">fun </span>k <span style="color: blue">-&gt; </span>WriteAsHeader (k.ToString())) 
            | _ <span style="color: blue">-&gt; </span>()
    </font></font><font face="Consolas"><font size="1"><span style="color: blue">else
        </span>printfn </font></font><font face="Consolas"><font size="1"><span style="color: maroon">&quot;failed to obtain answer from WordNet ...&quot;

</span>printfn </font></font><font size="1"><font face="Consolas"><span style="color: maroon">&quot;press &lt;any&gt; key to exit&quot; 
</span>System.Console.ReadLine() |&gt; ignore</font>
</font></pre>

<p>As you can see, the main processing is rather small. The <font size="1" face="Consolas">stopwords</font> array would clearly not be constant but expanded and stored elsewhere. <font size="1" face="Consolas">WriteAsHeader</font> is a simple function, which encloses some string within two horizontal bars (see bottom <font size="1" face="Consolas">FWordNetHelper</font> module). <font size="1" face="Consolas">saveAnswerHTML</font> will simply dump and HTML response in a file in the local file system, which can be helpful in offline testing mode.</p>

<p>The <font size="1" face="Consolas">askWordNet</font> function is a simple wrapper around:</p>

<ol>
  <li>Constructing an HTTP request URL from the user’s word and WordNet’s processing options </li>

  <li>Invoking a web request via .NET means (i.e., <font size="1" face="Consolas">System.Net.HttpWebRequest</font>) </li>

  <li>Getting the request’s response </li>

  <li>Outputting the response as a string </li>
</ol>

<pre class="code"><font face="Consolas"><font size="1"><span style="color: blue">let </span>askWordNet word (option:WordNetOptions) =
    <span style="color: blue">let </span>url = </font></font><font face="Consolas"><font size="1"><span style="color: maroon">&quot;https://wordnetweb.princeton.edu/perl/webwn&quot;
    </span><span style="color: blue">if </span>(System.String.IsNullOrEmpty(word) = <span style="color: blue">true</span>) <span style="color: blue">then </span>failwith </font></font><font face="Consolas"><font size="1"><span style="color: maroon">&quot;word cannot be null or empty&quot;
    </span><span style="color: blue">let </span>wordneturl = url + (buildRequestString word option)

    printfn <span style="color: maroon">&quot;requesting: %s&quot; </span>wordneturl

    <span style="color: blue">let </span>rq = System.Net.HttpWebRequest.Create(wordneturl)
    <span style="color: blue">let </span>resp = ref </font></font><span style="color: maroon"><font size="1" face="Consolas">&quot;&quot;
    
    </font></span><font face="Consolas"><font size="1"><span style="color: blue">try
        </span>using (<span style="color: blue">new </span>System.IO.StreamReader(rq.GetResponse().GetResponseStream())) ( <span style="color: blue">fun </span>s </font></font><font face="Consolas"><font size="1"><span style="color: blue">-&gt; 
            </span>resp := s.ReadToEnd()
        )
    </font></font><font face="Consolas"><font size="1"><span style="color: blue">with
        </span>| :? System.Net.WebException <span style="color: blue">-&gt; </span>( printfn <span style="color: maroon">&quot;failed to connect to \&quot;%s\&quot;\r\n&quot; </span>url )

    !resp</font></font></pre>

<p>The programs heavy-lifting is done inside the <font size="1" face="Consolas">processWordNetAnswer</font> , which takes the user’s word, the WordNet options and the request’s response (as a string), to do the following:</p>

<ol>
  <li>Create an HTML document using the HtmlAgilityPack </li>

  <li>Scrape the HTML document, so that a list of SynSet entries will be constructed for the user’s word </li>

  <li>Return the constructed list </li>
</ol>

<pre class="code"><font face="Consolas"><font size="1"><span style="color: blue">let </span>processWordNetAnswer (word:string) answer options showErrors = 
    <span style="color: blue">let </span>doc = <span style="color: blue">new </span>HtmlDocument()
    
    doc.LoadHtml(answer)
    printfn </font></font><font face="Consolas"><font size="1"><span style="color: maroon">&quot;Html Parse Errors ... &quot;
    </span><span style="color: blue">if </span>showErrors </font></font><font face="Consolas"><font size="1"><span style="color: blue">then 
        </span>doc.ParseErrors 
            |&gt; Seq.iter(<span style="color: blue">fun </span>err </font></font><font face="Consolas"><font size="1"><span style="color: blue">-&gt; 
                </span>(printfn <span style="color: maroon">&quot;%d %d %s %s&quot; </span>err.Line err.LinePosition err.Reason err.SourceText) 
            )
    
    <span style="color: blue">let </span>synList = List&lt;SynSet&gt;()

    (FindListItemNode doc.DocumentNode <span style="color: maroon">&quot;li&quot;</span>)
        |&gt; Seq.iter(<span style="color: blue">fun </span>liNode </font></font><font face="Consolas"><font size="1"><span style="color: blue">-&gt; 
            let </span>freqRegex = Regex(<span style="color: maroon">&quot;^(\((?&lt;Frequency&gt;\d+)\))?&quot; </span>+ 
                                  <span style="color: maroon">&quot;(\{(?&lt;DatabaseLocation&gt;\d+)\})?&quot; </span>+ 
                                  <span style="color: maroon">&quot;(\x20&amp;lt;(?&lt;FileInfo&gt;.+\..+)&amp;gt;)?&quot; </span>+
                                  <span style="color: maroon">&quot;(\[(?&lt;FileNumber&gt;\d+)\])?(\x20)?&lt;a&quot;</span>)

            <span style="color: blue">let </span>rMatch = freqRegex.Match(liNode.InnerHtml)
            <span style="color: blue">let mutable </span>freq = -1;
            <span style="color: blue">let mutable </span>dbloc = System.String.Empty
            <span style="color: blue">let mutable </span>fileInfo = System.String.Empty
            <span style="color: blue">let mutable </span>fileNumber = System.String.Empty

            <span style="color: blue">if </span>rMatch.Success </font></font><font face="Consolas"><font size="1"><span style="color: blue">then 

                let </span>freqStr = rMatch.Groups.Item(<span style="color: maroon">&quot;Frequency&quot;</span>).Value
                <span style="color: blue">let </span>locStr = rMatch.Groups.Item(<span style="color: maroon">&quot;DatabaseLocation&quot;</span>).Value
                <span style="color: blue">let </span>fileInfoStr = rMatch.Groups.Item(<span style="color: maroon">&quot;FileInfo&quot;</span>).Value
                <span style="color: blue">let </span>fileNoStr = rMatch.Groups.Item(<span style="color: maroon">&quot;FileNumber&quot;</span>).Value

                <span style="color: blue">if </span>(System.String.IsNullOrEmpty(freqStr) = <span style="color: blue">false</span>) <span style="color: blue">then  </span>freq &lt;- System.Int32.Parse(freqStr) ;
                <span style="color: blue">if </span>(System.String.IsNullOrEmpty(locStr) = <span style="color: blue">false</span>) <span style="color: blue">then </span>dbloc &lt;- locStr
                <span style="color: blue">if </span>(System.String.IsNullOrEmpty(fileInfoStr) = <span style="color: blue">false</span>) <span style="color: blue">then </span>fileInfo &lt;- fileInfoStr
                <span style="color: blue">if </span>(System.String.IsNullOrEmpty(fileNoStr) = <span style="color: blue">false</span>) <span style="color: blue">then </span>fileNumber &lt;- fileNoStr

            <span style="color: blue">let </span>xSyn = ref { 
                EmptySynSet </font></font><font face="Consolas"><font size="1"><span style="color: blue">with 
                    </span>FrequencyCount = freq; 
                    DatabaseLocation = dbloc; 
                    LexicalFileInfo = fileInfo ; 
                    LexicalFileNumber = fileNumber; 
            }
            
            liNode.ChildNodes 
                |&gt; Seq.iter(<span style="color: blue">fun </span>node <span style="color: blue">-&gt; </span>xSyn := ( FillSynSet node !xSyn word) )
            
            synList.Add( sanitiseSynSet !xSyn )
        )
    
    <span style="color: blue">if </span>synList.Count &lt;&gt; 0 <span style="color: blue">then </span>Some(synList)
    <span style="color: blue">else </span>None</font></font></pre>

<p>Using HtmlAgilityPack proves extremely beneficial to decompose the HTML response, into WordNet relevant atoms. <font size="1" face="Consolas">FindListItemNode</font> is a simple recursive HTML document traversing function which seeks to find the list item nodes within the html document. <font size="1" face="Consolas">FillSynSet</font> uses the power of F# pattern matching to fill a SynSet from information found in the reponses list items.</p>

<pre class="code"><font face="Consolas"><font size="1"><span style="color: blue">let </span>FillSynSet (node:HtmlNode) (syn:SynSet) (word:string) = 
    <span style="color: blue">match </span>(node, word) </font></font><font face="Consolas"><font size="1"><span style="color: blue">with
        </span>| POS(n) </font></font><font face="Consolas"><font size="1"><span style="color: blue">-&gt; 
            match </span>n </font></font><font face="Consolas"><font size="1"><span style="color: blue">with
                </span>| Noun <span style="color: blue">-&gt; </span>{ syn <span style="color: blue">with </span>SType = SynNoun; }
                | Verb <span style="color: blue">-&gt; </span>{ syn <span style="color: blue">with </span>SType = SynVerb; }
                | Adjective <span style="color: blue">-&gt; </span>{ syn <span style="color: blue">with </span>SType = SynAdjective; }
                | _ <span style="color: blue">-&gt; </span>( failwith (<span style="color: maroon">&quot;Error: Unrecognized POS \&quot;&quot; </span>+ n.ToString() + <span style="color: maroon">&quot;\&quot;!&quot;</span>) )
        | SynExample(e) </font></font><font face="Consolas"><font size="1"><span style="color: blue">-&gt; 
            </span>(
                <span style="color: blue">let </span>exampleSentences = 
                    ( e.Split([|<span style="color: maroon">&quot;;&quot;</span>|], System.StringSplitOptions.RemoveEmptyEntries) 
                        |&gt; Seq.map( <span style="color: blue">fun </span>entry <span style="color: blue">-&gt; </span>entry.Trim() ) 
                    )
                { syn <span style="color: blue">with </span>SynExampleSentences = ( Seq.append syn.SynExampleSentences exampleSentences ) ; } 
            )
        | SynWord(n) <span style="color: blue">-&gt; </span>{ syn <span style="color: blue">with </span>SynWords = (Seq.append syn.SynWords [n]) ; }
        | SynGlos(g) <span style="color: blue">-&gt; </span>{ syn <span style="color: blue">with </span>SynGlos = ( Seq.append syn.SynGlos [g] ); }
        | SynIndicator(n) | SynWordDesc (n) <span style="color: blue">-&gt; </span>syn

<span style="color: blue">let </span>FindListItemNode (startNode:HtmlNode) soughtNodeName = 
    <span style="color: blue">let </span>col = <span style="color: blue">new </span>List&lt;HtmlNode&gt;()

    <span style="color: blue">let rec </span>FindListItemNode_t (startNode:HtmlNode) soughtNodeName currentCollection = 
        <span style="color: blue">if </span>startNode = <span style="color: blue">null then </span>()
        </font></font><font face="Consolas"><font size="1"><span style="color: blue">else
            if </span>startNode.Name = soughtNodeName <span style="color: blue">then </span>( col.Add(startNode) ) 
            </font></font><font face="Consolas"><font size="1"><span style="color: blue">else 
                </span>startNode.ChildNodes 
                    |&gt; Seq.iter(<span style="color: blue">fun </span>n <span style="color: blue">-&gt; </span>(FindListItemNode_t n soughtNodeName col))

    FindListItemNode_t startNode soughtNodeName col
    col</font></font></pre>

<p>In order to have some data cleansing, the <font size="1" face="Consolas">sanitiseSynSet</font> function takes a SynSet and cleans it from potentially unwanted artefacts (not done extensively). As you can see, having a simple WordNet scraper is indeed not that hard, all left are mentioned helper functions, which depending on your visualisation needs can be dropped:</p>

<pre class="code"><font face="Consolas"><font size="1"><span style="color: blue">module </span>FWordNetHelper

<span style="color: blue">open </span>FWordNetTypes

<span style="color: blue">let </span>saveAnswerHTML (word:string) (answer:string) = 
    <span style="color: blue">let </span>time = System.DateTime.Now.Ticks.ToString()
    <span style="color: blue">let </span>fileName = System.String.Format(</font></font><font face="Consolas"><font size="1"><span style="color: maroon">@&quot;.\{0}_{1}.html&quot;
        </span>, word
        , time
    )

    using (System.IO.File.CreateText(fileName)) (<span style="color: blue">fun </span>f </font></font><font face="Consolas"><font size="1"><span style="color: blue">-&gt;
        </span>f.Write(answer)
        f.Flush()
    )

<span style="color: blue">let </span>buildRequestString (word:string) (option:WordNetOptions) =
    <span style="color: blue">let </span>str = System.String.Format(</font></font><font face="Consolas"><font size="1"><span style="color: maroon">&quot;?s={0}&amp;sub=Search+WordNet&amp;{1}&quot;
        </span>, word
        , ( option.BuildWordNetOptionsString() ) 
    )
    str

<span style="color: blue">let </span>WriteAsHeader s = 
    printfn </font></font><font face="Consolas"><font size="1"><span style="color: maroon">&quot;______________________________________________________\r\n&quot;
    </span>printfn <span style="color: maroon">&quot;%s&quot; </span>s
    printfn </font></font><span style="color: maroon"><font size="1" face="Consolas">&quot;______________________________________________________\r\n&quot;</font>
</span></pre>

<p>&#160;</p>

<p>From that, we might actually finish our little program by adding necessary namespace and module declarations:</p>

<pre class="code"><font face="Consolas"><font size="1"><span style="color: blue">module </span>FWordNetOnline

<span style="color: blue">open </span>System.Text
<span style="color: blue">open </span>System.Text.RegularExpressions
<span style="color: blue">open </span>System.Net
<span style="color: blue">open </span>System.IO
<span style="color: blue">open </span>System.Collections.Generic

<span style="color: blue">open </span>FWordNetTypes
<span style="color: blue">open </span>FWordNetHelper

<span style="color: blue">open </span>HtmlAgilityPack</font></font></pre>

<p>and ask WordNet about the known word “Dog”:</p>

<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/28/94/metablogapi/1256.AskWordNet_6C965E4C.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-28-94-metablogapi/1256.AskWordNet_5F00_6C965E4C.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="AskWordNet" border="0" alt="AskWordNet" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/28/94/metablogapi/5861.AskWordNet_thumb_4BA2EBA5.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-28-94-metablogapi/5861.AskWordNet_5F00_thumb_5F00_4BA2EBA5.png" width="493" height="94" /></a></p>

<p>which, if all goes well, will answer with the following (partial) processed response:</p>

<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/28/94/metablogapi/8883.WordNetResponse_2A434609.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-28-94-metablogapi/8883.WordNetResponse_5F00_2A434609.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="WordNetResponse" border="0" alt="WordNetResponse" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/28/94/metablogapi/7411.WordNetResponse_thumb_3C3F63C9.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-28-94-metablogapi/7411.WordNetResponse_5F00_thumb_5F00_3C3F63C9.png" width="654" height="565" /></a></p>

<p>Equipped with that dear reader, a happy exploration of the wonderful world of words using WordNet Online. In case of comments, improvements, please do not hesitate to comment – as only the ignorant is immune to learning.</p>]]></content:encoded>
    </item>
    <item>
      <title>F# and TFS2010–Retrieving all Work Items</title>
      <link>https://docs.microsoft.com/archive/blogs/christianb/f-and-tfs2010retrieving-all-work-items</link>
      <pubDate>Wed, 01 Jun 2011 06:44:44 GMT</pubDate>
      <dc:creator><![CDATA[cbitter]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/christianb/2011/06/01/f-and-tfs2010retrieving-all-work-items/</guid>
      <description><![CDATA[&#160;  Today’s post is merely a little code fragment, that gets you started with using the TFS2010...]]></description>
      <content:encoded><![CDATA[<p>&#160;</p>  <p>Today’s post is merely a little code fragment, that gets you started with using the TFS2010 API from F#.</p>  <p>Assuming you have referenced the following Assemblies:</p>  <ol>   <li>System.Windows.Forms </li>    <li>Microsoft.TeamFoundation.Client </li>    <li>Microsoft.TeamFoundation.Common </li>    <li>Microsoft.TeamFoundation.WorkItemTracking.Client </li> </ol>  <p>the following code connects to a TFS Server (cbtfs, you might want to change the URI to your needs) on the default port (8080) and loads up information about the <font size="1" face="Consolas">TeamProjectCollection</font> <font size="1" face="Consolas">DefaultCollection</font>. This will succeed under the assumption that valid credentials are supplied to the <font size="1" face="Consolas">UICredentialsProvider</font>. The <font size="1" face="Consolas">UICredentialsProvider</font> is also the reason why the assembly reference to <font size="1" face="Consolas">System.Windows.Forms</font> is demanded.</p>  <p>After successful authentication, a simple work item query (wiql) is constructed retrieving all work items available for that <font size="1" face="Consolas">TeamProjectCollection</font>. Finally, each work item’s id and title information is displayed on the console.</p>  <p><em>Edit 2011-06-02</em></p>  <p><em>I corrected the flow to account for previously checked project collection exception and incorporated a use of sequence expressions to make it feel more F#-ish</em></p>  <p>&#160;</p>  <pre class="code"><font face="Consolas"><font size="1"><span style="color: green">// Learn more about F# at <a href="https://fsharp.netmodule">https://fsharp.net
</span><span style="color: blue">module</a> </span>TFSTest

<span style="color: blue">open </span>System.Net
<span style="color: blue">open </span>Microsoft.TeamFoundation
<span style="color: blue">open </span>Microsoft.TeamFoundation.Common
<span style="color: blue">open </span>Microsoft.TeamFoundation.Client
<span style="color: blue">open </span>Microsoft.TeamFoundation.WorkItemTracking.Client

<span style="color: blue">let </span>projectCollectionUri = System.Uri(<span style="color: maroon">&quot;https://cbtfs:8080/tfs/DefaultCollection&quot;</span>)
<span style="color: blue">let mutable </span>projectCollection:TfsTeamProjectCollection = </font></font><font face="Consolas"><font size="1"><span style="color: blue">null

try
    
    </span>projectCollection &lt;- TfsTeamProjectCollectionFactory.GetTeamProjectCollection(
        projectCollectionUri
        , <span style="color: blue">new </span>UICredentialsProvider()
    )
    
    projectCollection.EnsureAuthenticated()

    printfn </font></font><span style="color: maroon"><font size="1" face="Consolas">&quot;authenticated with your tfs ... &quot;
</font></span><font face="Consolas"><font size="1"><span style="color: blue">with
    </span>| :? TeamFoundationServerUnauthorizedException </font></font><font face="Consolas"><font size="1"><span style="color: blue">-&gt; 
        </span>( printfn <span style="color: maroon">&quot;error: failed to authorize with TFS service!&quot;</span>)
    | :? TeamFoundationServiceUnavailableException </font></font><font face="Consolas"><font size="1"><span style="color: blue">-&gt; 
        </span>( printfn <span style="color: maroon">&quot;error: failed to connect to TFS service - service unavailable!&quot;</span>)
    | :? WebException </font></font><font face="Consolas"><font size="1"><span style="color: blue">-&gt; 
        </span>(printfn <span style="color: maroon">&quot;error: Network problem!&quot; </span>)

<span style="color: blue">let mutable </span>workItemStoreService = </font></font><font face="Consolas"><font size="1"><span style="color: blue">null

if </span>(projectCollection &lt;&gt; <span style="color: blue">null</span>) </font></font><font face="Consolas"><font size="1"><span style="color: blue">then
    try
        </span>workItemStoreService &lt;- projectCollection.GetService&lt;WorkItemStore&gt;()
        printfn </font></font><span style="color: maroon"><font size="1" face="Consolas">&quot;Connected to WorkItemStoreService&quot;
    </font></span><font face="Consolas"><font size="1"><span style="color: blue">with
        </span>| :? System.Exception </font></font><font face="Consolas"><font size="1"><span style="color: blue">-&gt; 
            </span>(printfn <span style="color: maroon">&quot;error: failed to connect to workitemstore&quot;</span>)

<span style="color: blue">if </span>(workItemStoreService &lt;&gt; <span style="color: blue">null</span>) </font></font><font face="Consolas"><font size="1"><span style="color: blue">then 

    let </span>workItems = workItemStoreService.Query(
        </font></font><font face="Consolas"><font size="1"><span style="color: maroon">&quot;SELECT [System.Id], [System.Title] FROM WorkItems&quot;
    </span>)

    <span style="color: blue">if </span>(workItems &lt;&gt; <span style="color: blue">null </span>&amp;&amp; workItems.Count &gt; 0) </font></font><font face="Consolas"><font size="1"><span style="color: blue">then
        let </span>workItemSequence = seq { <span style="color: blue">for </span>i <span style="color: blue">in </span>1 .. (workItems.Count - 1) <span style="color: blue">do yield </span>workItems.Item(i) }
        workItemSequence 
            |&gt; Seq.iter(<span style="color: blue">fun </span>item <span style="color: blue">-&gt; </span>(printfn <span style="color: maroon">&quot;[%d] %s&quot; </span>(item.Id) (item.Title)))
 
printfn </font></font><font face="Consolas"><font size="1"><span style="color: maroon">&quot;press any key to exit&quot;
</span>System.Console.ReadLine() |&gt; ignore</font></font></pre>]]></content:encoded>
    </item>
  </channel>
</rss>