Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2c9212a

Browse files
committed
Merge branch 'master' into release
2 parentse960109 +f7b8d46 commit2c9212a

16 files changed

+219
-277
lines changed

‎src/main/java/org/apache/commons/text/similarity/CosineSimilarity.java‎

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
publicclassCosineSimilarity {
3535

3636
/**
37-
*Singleton instance.
37+
*The singleton instance.
3838
*/
3939
staticfinalCosineSimilarityINSTANCE =newCosineSimilarity();
4040

@@ -48,9 +48,9 @@ public CosineSimilarity() {
4848
/**
4949
* Calculates the cosine similarity for two given vectors.
5050
*
51-
* @param leftVector left vector
52-
* @param rightVector right vector
53-
* @return cosine similarity between the two vectors
51+
* @param leftVector left vector.
52+
* @param rightVector right vector.
53+
* @return cosine similarity between the two vectors.
5454
*/
5555
publicDoublecosineSimilarity(finalMap<CharSequence,Integer>leftVector,
5656
finalMap<CharSequence,Integer>rightVector) {
@@ -83,10 +83,10 @@ public Double cosineSimilarity(final Map<CharSequence, Integer> leftVector,
8383
* that if a vector is longer than other, then a smaller part of it will be used to compute
8484
* the dot product.
8585
*
86-
* @param leftVector left vector
87-
* @param rightVector right vector
88-
* @param intersection common elements
89-
* @return The dot product
86+
* @param leftVector left vector.
87+
* @param rightVector right vector.
88+
* @param intersection common elements.
89+
* @return The dot product.
9090
*/
9191
privatedoubledot(finalMap<CharSequence,Integer>leftVector,finalMap<CharSequence,Integer>rightVector,
9292
finalSet<CharSequence>intersection) {
@@ -100,9 +100,9 @@ private double dot(final Map<CharSequence, Integer> leftVector, final Map<CharSe
100100
/**
101101
* Returns a set with keys common to the two given maps.
102102
*
103-
* @param leftVector left vector map
104-
* @param rightVector right vector map
105-
* @return common strings
103+
* @param leftVector left vector map.
104+
* @param rightVector right vector map.
105+
* @return common strings.
106106
*/
107107
privateSet<CharSequence>getIntersection(finalMap<CharSequence,Integer>leftVector,
108108
finalMap<CharSequence,Integer>rightVector) {

‎src/main/java/org/apache/commons/text/similarity/EditDistanceFrom.java‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ public EditDistanceFrom(final EditDistance<R> editDistance, final CharSequence l
8080
* Compares "left" field against the "right" parameter
8181
* using the "edit distance" implementation.
8282
*
83-
* @param right the second CharSequence
84-
* @return The similarity score between two CharSequences
83+
* @param right the second CharSequence.
84+
* @return The similarity score between two CharSequences.
8585
*/
8686
publicRapply(finalCharSequenceright) {
8787
returneditDistance.apply(left,right);
@@ -90,7 +90,7 @@ public R apply(final CharSequence right) {
9090
/**
9191
* Gets the edit distance.
9292
*
93-
* @return The edit distance
93+
* @return The edit distance.
9494
*/
9595
publicEditDistance<R>getEditDistance() {
9696
returneditDistance;
@@ -99,7 +99,7 @@ public EditDistance<R> getEditDistance() {
9999
/**
100100
* Gets the left parameter.
101101
*
102-
* @return The left parameter
102+
* @return The left parameter.
103103
*/
104104
publicCharSequencegetLeft() {
105105
returnleft;

‎src/main/java/org/apache/commons/text/similarity/FuzzyScore.java‎

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,8 @@ public class FuzzyScore {
4343
/**
4444
* This returns a {@link Locale}-specific {@link FuzzyScore}.
4545
*
46-
* @param locale The string matching logic is case insensitive.
47-
A {@link Locale} is necessary to normalize both Strings to lower case.
48-
* @throws IllegalArgumentException
49-
* This is thrown if the {@link Locale} parameter is {@code null}.
46+
* @param locale The string matching logic is case insensitive. A {@link Locale} is necessary to normalize both Strings to lower case.
47+
* @throws IllegalArgumentException This is thrown if the {@link Locale} parameter is {@code null}.
5048
*/
5149
publicFuzzyScore(finalLocalelocale) {
5250
if (locale ==null) {
@@ -56,8 +54,7 @@ public FuzzyScore(final Locale locale) {
5654
}
5755

5856
/**
59-
* Find the Fuzzy Score which indicates the similarity score between two
60-
* Strings.
57+
* Find the Fuzzy Score which indicates the similarity score between two Strings.
6158
*
6259
* <pre>
6360
* score.fuzzyScore(null, null) = IllegalArgumentException
@@ -72,11 +69,10 @@ public FuzzyScore(final Locale locale) {
7269
* score.fuzzyScore("Apache Software Foundation", "asf") = 3
7370
* </pre>
7471
*
75-
* @param term a full term that should be matched against, must not be null
76-
* @param query the query that will be matched against a term, must not be
77-
* null
78-
* @return result score
79-
* @throws IllegalArgumentException if the term or query is {@code null}
72+
* @param term a full term that should be matched against, must not be null.
73+
* @param query the query that will be matched against a term, must not be null.
74+
* @return result score.
75+
* @throws IllegalArgumentException if the term or query is {@code null}.
8076
*/
8177
publicIntegerfuzzyScore(finalCharSequenceterm,finalCharSequencequery) {
8278
if (term ==null ||query ==null) {

‎src/main/java/org/apache/commons/text/similarity/IntersectionResult.java‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@ public class IntersectionResult {
4949
/**
5050
* Constructs the results for an intersection between two sets.
5151
*
52-
* @param sizeA the size of set A ({@code |A|})
53-
* @param sizeB the size of set B ({@code |B|})
54-
* @param intersection the size of the intersection of A and B ({@code |A &#8745; B|})
52+
* @param sizeA the size of set A ({@code |A|}).
53+
* @param sizeB the size of set B ({@code |B|}).
54+
* @param intersection the size of the intersection of A and B ({@code |A &#8745; B|}).
5555
* @throws IllegalArgumentException if the sizes are negative or the intersection is greater
56-
* than the minimum of the two set sizes
56+
* than the minimum of the two set sizes.
5757
*/
5858
publicIntersectionResult(finalintsizeA,finalintsizeB,finalintintersection) {
5959
if (sizeA <0) {

‎src/main/java/org/apache/commons/text/similarity/IntersectionSimilarity.java‎

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ private TinyBag(final int initialCapacity) {
8282
/**
8383
* Adds a new element to the bag, incrementing its count in the underlying map.
8484
*
85-
* @param object the object to add
85+
* @param object the object to add.
8686
*/
8787
privatevoidadd(finalTobject) {
8888
map.computeIfAbsent(object,k ->newBagCount()).count++;
@@ -91,7 +91,7 @@ private void add(final T object) {
9191
/**
9292
* Returns a Set view of the mappings contained in this bag.
9393
*
94-
* @return The Set view
94+
* @return The Set view.
9595
*/
9696
privateSet<Entry<T,BagCount>>entrySet() {
9797
returnmap.entrySet();
@@ -101,8 +101,8 @@ private Set<Entry<T, BagCount>> entrySet() {
101101
* Returns the number of occurrence of the given element in this bag by
102102
* looking up its count in the underlying map.
103103
*
104-
* @param object the object to search for
105-
* @return The number of occurrences of the object, zero if not found
104+
* @param object the object to search for.
105+
* @return The number of occurrences of the object, zero if not found.
106106
*/
107107
privateintgetCount(finalObjectobject) {
108108
returnmap.getOrDefault(object,BagCount.ZERO).count;
@@ -111,7 +111,7 @@ private int getCount(final Object object) {
111111
/**
112112
* Gets the number of unique elements in the bag.
113113
*
114-
* @return The unique element size
114+
* @return The unique element size.
115115
*/
116116
privateintuniqueElementSize() {
117117
returnmap.size();
@@ -122,10 +122,10 @@ private int uniqueElementSize() {
122122
* Computes the intersection between two sets. This is the count of all the elements
123123
* that are within both sets.
124124
*
125-
* @param <T> the type of the elements in the set
126-
* @param setA the set A
127-
* @param setB the set B
128-
* @return The intersection
125+
* @param <T> the type of the elements in the set.
126+
* @param setA the set A.
127+
* @param setB the set B.
128+
* @return The intersection of A and B.
129129
*/
130130
privatestatic <T>intgetIntersection(finalSet<T>setA,finalSet<T>setB) {
131131
intintersection =0;
@@ -149,8 +149,8 @@ private static <T> int getIntersection(final Set<T> setA, final Set<T> setB) {
149149
* that will include duplicates in the intersect and union.
150150
* </p>
151151
*
152-
* @param converter the converter used to create the elements from the characters
153-
* @throws IllegalArgumentException if the converter is null
152+
* @param converter the converter used to create the elements from the characters.
153+
* @throws IllegalArgumentException if the converter is null.
154154
*/
155155
publicIntersectionSimilarity(finalFunction<CharSequence,Collection<T>>converter) {
156156
if (converter ==null) {
@@ -162,10 +162,10 @@ public IntersectionSimilarity(final Function<CharSequence, Collection<T>> conver
162162
/**
163163
* Calculates the intersection of two character sequences passed as input.
164164
*
165-
* @param left first character sequence
166-
* @param right second character sequence
167-
* @return The intersection result
168-
* @throws IllegalArgumentException if either input sequence is {@code null}
165+
* @param left first character sequence.
166+
* @param right second character sequence.
167+
* @return The intersection result.
168+
* @throws IllegalArgumentException if either input sequence is {@code null}.
169169
*/
170170
@Override
171171
publicIntersectionResultapply(finalCharSequenceleft,finalCharSequenceright) {
@@ -210,9 +210,9 @@ public IntersectionResult apply(final CharSequence left, final CharSequence righ
210210
* Computes the intersection between two bags. This is the sum of the minimum
211211
* count of each element that is within both sets.
212212
*
213-
* @param bagA the bag A
214-
* @param bagB the bag B
215-
* @return The intersection
213+
* @param bagA the bag A.
214+
* @param bagB the bag B.
215+
* @return The intersection of A and B.
216216
*/
217217
privateintgetIntersection(finalTinyBagbagA,finalTinyBagbagB) {
218218
intintersection =0;
@@ -229,8 +229,8 @@ private int getIntersection(final TinyBag bagA, final TinyBag bagB) {
229229
* Converts the collection to a bag. The bag will contain the count of each element
230230
* in the collection.
231231
*
232-
* @param objects the objects
233-
* @return The bag
232+
* @param objects the objects.
233+
* @return The bag.
234234
*/
235235
privateTinyBagtoBag(finalCollection<T>objects) {
236236
finalTinyBagbag =newTinyBag(objects.size());

‎src/main/java/org/apache/commons/text/similarity/JaccardDistance.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public JaccardDistance() {
4040
*
4141
* @param left first input sequence.
4242
* @param right second input sequence.
43-
* @returnindex
43+
* @returnThe Jaccard distance.
4444
* @throws IllegalArgumentException if either String input {@code null}.
4545
*/
4646
@Override
@@ -54,7 +54,7 @@ public Double apply(final CharSequence left, final CharSequence right) {
5454
* @param <E> The type of similarity score unit.
5555
* @param left first input sequence.
5656
* @param right second input sequence.
57-
* @return index
57+
* @return index.
5858
* @throws IllegalArgumentException if either String input {@code null}.
5959
*/
6060
public <E>Doubleapply(finalSimilarityInput<E>left,finalSimilarityInput<E>right) {

‎src/main/java/org/apache/commons/text/similarity/JaccardSimilarity.java‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
publicclassJaccardSimilarityimplementsSimilarityScore<Double> {
3333

3434
/**
35-
*Singleton instance.
35+
*The singleton instance.
3636
*/
3737
staticfinalJaccardSimilarityINSTANCE =newJaccardSimilarity();
3838

@@ -48,7 +48,7 @@ public JaccardSimilarity() {
4848
*
4949
* @param left first input sequence.
5050
* @param right second input sequence.
51-
* @returnindex.
51+
* @returnThe Jaccard Similarity of two set character sequence passed as input.
5252
* @throws IllegalArgumentException if either String input {@code null}.
5353
*/
5454
@Override
@@ -63,7 +63,7 @@ public Double apply(final CharSequence left, final CharSequence right) {
6363
* @param <E> The type of similarity score unit.
6464
* @param left first input sequence.
6565
* @param right second input sequence.
66-
* @returnindex.
66+
* @returnThe Jaccard Similarity of two set character sequence passed as input.
6767
* @since 1.13.0
6868
*/
6969
public <E>Doubleapply(finalSimilarityInput<E>left,finalSimilarityInput<E>right) {

‎src/main/java/org/apache/commons/text/similarity/JaroWinklerDistance.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public JaroWinklerDistance() {
8181
* @param left the first input, must not be null.
8282
* @param right the second input, must not be null.
8383
* @return result distance.
84-
* @throws IllegalArgumentException if either CharSequence input is {@code null}
84+
* @throws IllegalArgumentException if either CharSequence input is {@code null}.
8585
*/
8686
@Override
8787
publicDoubleapply(finalCharSequenceleft,finalCharSequenceright) {

‎src/main/java/org/apache/commons/text/similarity/JaroWinklerSimilarity.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
publicclassJaroWinklerSimilarityimplementsSimilarityScore<Double> {
4040

4141
/**
42-
*Singleton instance.
42+
*The singleton instance.
4343
*/
4444
staticfinalJaroWinklerSimilarityINSTANCE =newJaroWinklerSimilarity();
4545

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp