Friday, July 11, 2014

How to use MonoGame 3 templates under Visual Studio 2013

Installing MonoGame (at least in current version 3.2) for Visual Studio 2013 can result in the templates not being available for new projects.

This is quite often the result of the Windows user management not being considered in the MonoGame installer: Visual Studio is run under a different account (usually a user account) than MonoGame was installed from (usually an admin account). The templates should be in the "documents\Visual Studio 2013\Templates\ProjectTemplates\Visual C#" folder, but are instead installed into the admin templates folder.

Should that be the case, simply copy the MonoGame folder from
C:\Users\<admin>\Documents\Visual Studio 2013\Templates\ProjectTemplates\Visual C#
to
C:\Users\<user>\Documents\Visual Studio 2013\Templates\ProjectTemplates\Visual C#

That should fix the problem.

Thursday, June 27, 2013

Weitere Planung

In den nächsten Wochen möchte ich hier einige kleinere - möglicherweise interessante - Compulerlinguistik-Projekte entwickeln und vorstellen.
Das wird in zumindest absehbarer Zeit weiterhin in Python geschehen, daher gibt es zwischendurch kleinere Pythonexkurse geben (einige Techniken funktionieren in Python anders als in anderen Programmiersprachen).
Das erste kleine Projekt wird ein Inverted Index werden. Der Index an sich ist vielleicht noch nicht besonders spannend (auch wenn ich persönlich widersprechen würde), aber auf ihm aufbauend wird eine kleine CL-Anwendung folgen.
Um ihn etwas interessante zu machen, wird die Index-Erzeugung etwas aufgepeppt: zunächst ein paralleler Aufbau (um die Besonderheiten der Parallelisierung unter Python zu demonstrieren und auf einem Multicore-System keine Rechenleistung zu verschwenden), anschließend darauf aufgebaut eine Implementierung mit einem hausgebauten MapReduce-Verfahren (auf einem einzelnen Rechner Verschwendung, aber MapReduce ist ein faszinierendes und auch wichtiges Konzept).
Danach schauen wir uns einige einfachere CL-Algorithmen und -Anwendungen an, die darauf aufgebaut werden können.

Der nächste Beitrag wird die Prinzipien eines Inverted Index beinhalten (was ist das überhaupt?) und einen Suchindex über eine Menge an Textdateien aufbauen - noch unelegant und ineffizient.

Um die Zeit bis dahin zu überbrücken, hier einige interessante Ressourcen und Quellen zu den allgemeinen Themen dieses Blogs:


StackExchange-Seiten für Machine Learning und NLP werden derzeit aufgebaut und hoffentlich in den nächsten Monaten freigegeben.

Monday, June 17, 2013

NLTK 3.0 supports Python 3 (somewhat)

For some time now, NLTK has an alpha release, officially supporting Python 3. It's still in its testing phase, but might be usable for some of you.
I hope to cover it in more detail and similar topics more... regularly in the future.

See here: http://nltk.org/nltk3-alpha/ for more details and download. Python 2.6, Python 2.7, and Python 3 (.x?) will be supported.

Sunday, December 18, 2011

Porting nltk to Python 3 - A systematic approach

Update: Look here for Python 3 development. You might also want to visit the user group or the development group.


Being done working through the nltk book, I finally started working somewhat more systematically. I am currently setting up a number of automatic tests (the official ones seem to be quite outdated, at least according to the source/issue tracker) and working on the identified classes of issues. 
I fixed some weird of the weirs fixes I made last time, as well (general except clause, loop inside a try, ...). The next step was looking for all occurrences of file readers using the bytes method and changing them into string (Unicode) readers.

Everything in chapter two should now work, including the stop words examples (fixed now) and the toolbox (fixed earlier in another chapter).

So far, errors are mainly caused by:
  • String/bytes/Unicode
  • Division returning a float instead of rounding
  • Differences in iterable objects/lists
  • Comparison no longer works with non-comparable object (especially while sorting lists)
  • tkinter name changes
That's the gist for now, but I am sure more will come to light while working on it.

Here the changed files: nltk_rev_1_changes.zip
Here the complete source: nltk_rev_1_complete.zip
Here a Windows installer (32-Bit): nltk_rev_1_win32_installer.msi

Using nltk with Python 3 (overview)

I am finally done getting at least the code from the official nltk book to work under Python 3. Aside from two things that do not work yet (will be covered later; might be due to changes in the nltk code base), it runs flawlessly

I learned quite a lot about the source code of nltk, so now there will be a more systematic approach. Though I probably still won't change the stream readers for now. As I found the official book somewhat lacking -- I did not want a general Python tutorial, and I prefer a somewhat more consistent introductial approach to language processing than a book that seems to be aimed at students offers -- I finally visited the nearest library. Now I will test my changes to the source on the examples and exercises found in (no particular order)
  • McNeil, J. (2010): Python 2.6 Text Processing. The easiest way to learn how to manipulate text with Python.
  • Perkins, J. (2010): Python Text Processing with NLTK 2.0 Cookbook.

Should I find the time, I will accompany the simple code changes with some snippets I am working on. I am thinking mainly about implementing parallel NLP tasks to finally apply my basic knowledge of Python multiprocessing and/or MapReduce/Hadoop.


Here are the changed files: (see here)
Here the complete nltk source with all changes: (see here)
Here is a Windows installer for nltk under Python 3 (x86): (see here)
Here is a complete and short list, consisting of all changes made to the nltk source: (TBD)

All parts from this post series:
  1. Introduction and overview
  2. nltk chapter 1: Language Processing and Python
  3. nltk chapter 2: Accessing Text Corpora and Lexical Resources
  4. nltk chapter 3: Processing Raw Text
  5. nltk chapter 4: Writing Structured Programs
  6. nltk chapter 5: Categorizing and Tagging Words
  7. nltk chapter 6: Learning to Classify Text
  8. nltk chapter 7: Extracting Information from Text
  9. nltk chapter 8: Analyzing Sentence Structure
  10. nltk chapter 9: Building Feature Based Grammars
  11. nltk chapter 10: Analyzing the Meaning of Sentences
  12. nltk chapter 11: Managing Linguistic Data

Using nltk with Python 3 (11)

And on to chapter 11: Managing Linguistic Data
It would be nice if the book could be updated some time in the future, as some namespaces are no longer correct. It works, though, sometimes it is just a matter of finding the correct name.

Using nltk with Python 3 (10)

And on to chapter 10: Analyzing the Meaning of Sentences