bae 0.0.4-java → 0.0.5-java

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 31e63c2a760670dddcc6b9c2ffc0f90d1fd7470e
4
- data.tar.gz: 4bf6e54182fbeb15372a9b3d1d04aa37d9641b0d
3
+ metadata.gz: b38b15d7de16ee8695e028a7c09e0318ef47290a
4
+ data.tar.gz: ddc9738a5b384a18b829a43a87bf1b15d82f7df9
5
5
  SHA512:
6
- metadata.gz: cb9f6571d71bd8800f9a9fda4b9f88678c58145164df7b6d7f474bc0dbd6482730202b36fd89b9cd3ac5fc248b46167d3c9a65d239b0aba7440d54c9a5b567bc
7
- data.tar.gz: 67c1e80d220d0e30315d9569da6e41f44d999291276980a87420437f934a9f4ee4a0231c5b50e78f87ee016e7f75ce2e097f46e33e9dea17b02bb7fc6434cb25
6
+ metadata.gz: b717b3732a5b358551e1153f3809bf27949cf9abebc8be26fd73794bec1d43eb002e5e603ce02baced904b1c8f1a63e4110c3dc7c52535da897770db640527dc
7
+ data.tar.gz: 2163c3e37d0b3e6ae97d149051153fd89949aeac2cfef625f585be5cf7aec5d8d41070bc5714c7c2a661870b67e919ab6ff379019bb56325f3e6f51248fba1d8
data/build.xml CHANGED
@@ -1,10 +1,10 @@
1
1
  <project>
2
2
 
3
3
  <target name="clean">
4
- <delete dir="build"/>
4
+ <delete dir="out/classes"/>
5
5
  </target>
6
6
 
7
- <target name="compile">
7
+ <target name="compile" depends="clean">
8
8
  <mkdir dir="out"/>
9
9
  <mkdir dir="out/classes"/>
10
10
  <javac srcdir="src/main/java" destdir="out/classes" source="1.7" target="1.7" includeantruntime="false" />
data/lib/bae/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Bae
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
@@ -33,7 +33,9 @@ public class Document {
33
33
 
34
34
  // Set initial count if it doesn't have one yet
35
35
  // Use zero because we'll add counts in the next line.
36
- this.frequencyMap.putIfAbsent(wordToken, 0L);
36
+ if(!this.frequencyMap.containsKey(wordToken)) {
37
+ this.frequencyMap.put(wordToken, 0L);
38
+ }
37
39
 
38
40
  // Update count
39
41
  this.frequencyMap.put(wordToken, this.frequencyMap.get(wordToken) + 1);
@@ -14,7 +14,9 @@ public class FrequencyTable {
14
14
 
15
15
  public void insertOrIgnore(String label) {
16
16
  // Add new hash to frequency table if it's not already there
17
- this.frequencyTable.putIfAbsent(label, new HashMap<String, Long>());
17
+ if(!this.frequencyTable.containsKey(label)) {
18
+ this.frequencyTable.put(label, new HashMap<String, Long>());
19
+ }
18
20
  }
19
21
 
20
22
  public void increaseFrequencyBy(String label, String word, long frequency) {
@@ -24,7 +26,9 @@ public class FrequencyTable {
24
26
  Map<String, Long> frequencyRow = this.frequencyTable.get(label);
25
27
 
26
28
  // Make sure we have a frequency for that position in the table
27
- frequencyRow.putIfAbsent(word, 0L);
29
+ if(!frequencyRow.containsKey(word)) {
30
+ frequencyRow.put(word, 0L);
31
+ }
28
32
 
29
33
  // Update frequency
30
34
  frequencyRow.put(word, frequencyRow.get(word) + frequency);
@@ -74,7 +74,9 @@ public class NaiveBayesClassifier {
74
74
  }
75
75
 
76
76
  // Default class posterior of label to 1.0
77
- classPosteriorOf.putIfAbsent(label, 1d);
77
+ if(!classPosteriorOf.containsKey(label)) {
78
+ classPosteriorOf.put(label, 1d);
79
+ }
78
80
 
79
81
  // Update class posterior
80
82
  double classPosterior = classPriorOf.get(label) * likelihoodOf.get(label);
@@ -93,12 +95,16 @@ public class NaiveBayesClassifier {
93
95
  }
94
96
 
95
97
  public void updateIntegerCountBy(Map<String, Long> someMap, String someKey, long count) {
96
- someMap.putIfAbsent(someKey, 0L);
98
+ if(!someMap.containsKey(someKey)) {
99
+ someMap.put(someKey, 0L);
100
+ }
97
101
  someMap.put(someKey, someMap.get(someKey) + count);
98
102
  }
99
103
 
100
104
  public void updateDoubleCountBy(Map<String, Double> someMap, String someKey, double count) {
101
- someMap.putIfAbsent(someKey, 0.0);
105
+ if(!someMap.containsKey(someKey)) {
106
+ someMap.put(someKey, 0.0);
107
+ }
102
108
  someMap.put(someKey, someMap.get(someKey) + count);
103
109
  }
104
110
 
data/target/bae.jar CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bae
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: java
6
6
  authors:
7
7
  - Garrett Thornburg