--- /dev/null
+import java.io.File\r
+\r
+/**\r
+ * Sentence anagrams generation\r
+ * MSE course, T-AdvPrPa course\r
+ */\r
+package object anagrams {\r
+\r
+ /**\r
+ * Loads a file dictionary which should be located in the src directory\r
+ */\r
+ def loadDictionary() = {\r
+ val wordstream = Option {\r
+ getClass.getClassLoader.getResourceAsStream("resources/linuxwords.txt")\r
+ } getOrElse {\r
+ sys.error("Could not load word list, dictionary file not found")\r
+ }\r
+ try {\r
+ val s = io.Source.fromInputStream(wordstream)\r
+ s.getLines.toList\r
+ } catch {\r
+ case e: Exception ⇒\r
+ println("Could not load word list: " + e)\r
+ throw e\r
+ } finally {\r
+ wordstream.close()\r
+ }\r
+ }\r
+}\r