dictionary - Google Ngram Viewer - English One Million

I'm training a language model in PyTorch and I'd need the most common one million words in English to serve as dictionary.From what I've understood, the Google Ngram English One Million (1-grams) might suit to this task, but after downloading every part (0-9) of this dataset and using tail on them to check if they were what I supposed, I found out that no part of this dataset contains words beyond the F letter.As far as I understood, any Version 1 file has its ngrams alphabetically and cronologically sorted and I'm concerned if it might be poss...Read more

How to overwrite a dictionary (list of key-val pairs) in SWI-prolog?

Here's my problem:I have a key-val pair dictionary similar to this (more pairs in real codes):args = [(score, 0), (multiplier, 1), (reward, 0), (prior_prob, 1)].I defined two functions to work with the dictionary:% look up the Val of a Key in a Dict lookup(Key,Dict,Val):- member((Key,Val), Dict).and% update(Key, NewVal, Dict, NewDict) updates the value of a key in the dictupdate(Key,Val,[],[(Key,Val)]). % Add new pair to current dictupdate(Key,Val,[(Key,_)|Rest], [(Key,Val)|Rest]):- !. % Found the key and update the valueupdate...Read more

dictionary - Loop through Map in Groovy?

I have a very simple task I am trying to do in Groovy but cannot seem to get it to work. I am just trying to loop through a map object in groovy and print out the key and value but this code does not work.// A simple mapdef map = [ iPhone : 'iWebOS', Android: '2.3.3', Nokia : 'Symbian', Windows: 'WM8']// Print the valuesfor (s in map) { println s + ": " + map[s]}I am trying to get the output to look like this:iPhone: iWebOSAndroid: 2.3.3Nokia: SymbianWindows: WM8Could someone please elaborate on how to do this??...Read more

dictionary - Seed data for sentiment analysis

I'm playing around with sentiment analysis, and I'm looking for some seed data. Is there a free dictionary around?It can be really simple: 3 sets of texts/sentences, for "positive", "negative", "neutral". It doesn't have to be huge.Eventually I'll probably generate my own seed data for my specific use case, but it would be great to have something to play with now while I'm building the thing....Read more

dictionary - Mapping a function on the values of a map in Clojure

I want to transform one map of values to another map with the same keys but with a function applied to the values. I would think there was a function for doing this in the clojure api, but I have been unable to find it. Here's an example implementation of what I'm looking for(defn map-function-on-map-vals [m f] (reduce (fn [altered-map [k v]] (assoc altered-map k (f v))) {} m))(println (map-function-on-map-vals {:a "test" :b "testing"} #(.toUpperCase %))){:b TESTING, :a TEST}Does anybody know if map-function-on-map-vals already exists? I would...Read more

dictionary - Clojure perform map function on array elements

I've defined persons like this (def persons '({:id 1 :name "olle"} {:id 2 :name "anna"} {:id 3 :name "isak"} {:id 4 :name "beatrice"}))I want to map elements from persons like this command here(map :id persons)(1 2 3 4)However the term :id will be within brackets like so [:id]. How do I cancel out the brackets so that a function in the form of (map [:id] persons) performs the same as (map :id persons)In addition it would be great if the numbers were displayed one per column with :id as the heading....Read more

dictionary - creating a nested clojure map by calling function with its keys and values

I am stuck with a problem.So the problem is.I have a map like this {:first {"value1" "value2" "value3"...} :second {"value1" "value2" "value3"...}....}. I have a function whichmake a request to the server with parameters (first&value1) and returnsome information (it must make request with each keys and theirvalues (first&value1, first&value2 ...second&value1...))Next step is to generate new map like:{:first {:value1 {subvalue1, subvalue2 ..} :value2 {subvalue2-1,subvalue2-2}} :second {:value3 {:subvalue3-1,...Read more

dictionary - call function to all items of sequence

I am trying to generate a nested map in Clojure.The problem is that. Firstly I have a sequence ("first" "second" "third" ...).Secondly I have a function by calling which with each element with sequence I want to receive a map like this {: first (functionfirst)}, {: second (function second)} and ..... .Finally i want to gether all result to a new map {:first {...} :second {...} :third {...}}.Maybe somebody gives me some an instruction or approaches how to do it.p.sSo i create a draft of my function (it does not work).(defn finder [sequence funct...Read more

dictionary - Clojure: How to apply a function to every value in a nested map and update?

Let's say there is a nested map like below: (partially nested only)(def mymap {:a 10 :b {:ba 21, :bb 22 :bc 23} :c 30 :d {:da 41, :db 42}})How can I apply a function, say (* % 2), and update every value in this map? That is without specifying any key. The result will look like this:{:a 20, :b {:ba 42, :bb 44, :bc 46}, :c 60, :d {:da 82, :db 84}}So far, I came up with this own function:(defn map-kv [f coll] (reduce-kv (fn [m k v] (assoc m k (f v))) (empty coll) coll))But I still need to specify a first-level key and can't...Read more

dictionary - Clojure- filter complex vector

I have been trying to filter complex vector like that(def mySymbolT [[:name "salary" :type "string" :kind "static" :index 0] [:name "money" :type "string" :kind "static" :index 1] [:name "count" :type "int" :kind "field" :index 0]])My goal is to return the quantity of elements that has the same kind:For example, for kind "static" I expect 2 as an answer.So far I got to write this:(defn countKind [symbolTable kind] (count(map first(filter #(= (:kind %) kind) symbolTable))))Its not working. I must say that I'm new to Clojure and I dont unders...Read more

dictionary - Clojure: working with refs in a collection

I am working with refs and I need some help.I have here 2 bank accounts with respective :operations (ref :name "bank" :accounts {12345678 (ref {:name "joey" :account-number 12345678 :operations (ref {:desc "DESC1" :amount 100 :date "2017-01-10"]}) (ref {:desc "DESC2" :amount 200 :date "2017-01-11"]}) (ref {:desc "DESC3" :amount 300 :date "2017-01-12"]})}) {87654321 (ref {:name "paul" ...Read more

dictionary - Don't know how to create ISeq from clojure

I want to add the values from a map on clojure with the next code: (letfn [(r [l a] (if (empty? l) a (if (map? l) (r (first(vals l)) (+ a (first (vals l)))) (r (rest l) (+ a (first l))))))] (r {:a 1 :b 2 :c 3} 0)but I get the following error: IllegalArgumentException Don't know how to create ISeq from: java.lang.Long clojure.lang.RT.seqFrom (RT.java:542)...Read more