浏览代码

[ML] Prefer American English spellings (#76915)

organisation -> organization
David Kyle 4 年之前
父节点
当前提交
283e6b1d4a

+ 3 - 3
x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/inference/nlp/NerProcessor.java

@@ -28,7 +28,7 @@ import java.util.Locale;
 public class NerProcessor implements NlpTask.Processor {
 
     public enum Entity implements Writeable {
-        NONE, MISC, PERSON, ORGANISATION, LOCATION;
+        NONE, MISC, PERSON, ORGANIZATION, LOCATION;
 
         @Override
         public void writeTo(StreamOutput out) throws IOException {
@@ -48,8 +48,8 @@ public class NerProcessor implements NlpTask.Processor {
         I_MISC(Entity.MISC),            // Miscellaneous entity
         B_PER(Entity.PERSON),           // Beginning of a person's name right after another person's name
         I_PER(Entity.PERSON),           // Person's name
-        B_ORG(Entity.ORGANISATION),     // Beginning of an organisation right after another organisation
-        I_ORG(Entity.ORGANISATION),     // Organisation
+        B_ORG(Entity.ORGANIZATION),     // Beginning of an organisation right after another organisation
+        I_ORG(Entity.ORGANIZATION),     // Organisation
         B_LOC(Entity.LOCATION),         // Beginning of a location right after another location
         I_LOC(Entity.LOCATION);         // Location
 

+ 4 - 4
x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/inference/nlp/NerProcessorTests.java

@@ -108,7 +108,7 @@ public class NerProcessorTests extends ESTestCase {
 
         assertThat(result.getEntityGroups().size(), equalTo(2));
         assertThat(result.getEntityGroups().get(0).getWord(), equalTo("elasticsearch"));
-        assertThat(result.getEntityGroups().get(0).getLabel(), equalTo(NerProcessor.Entity.ORGANISATION.toString()));
+        assertThat(result.getEntityGroups().get(0).getLabel(), equalTo(NerProcessor.Entity.ORGANIZATION.toString()));
         assertThat(result.getEntityGroups().get(1).getWord(), equalTo("london"));
         assertThat(result.getEntityGroups().get(1).getLabel(), equalTo(NerProcessor.Entity.LOCATION.toString()));
     }
@@ -144,7 +144,7 @@ public class NerProcessorTests extends ESTestCase {
 
         assertThat(result.getEntityGroups().size(), equalTo(2));
         assertThat(result.getEntityGroups().get(0).getWord(), equalTo("elasticsearch"));
-        assertThat(result.getEntityGroups().get(0).getLabel(), equalTo(NerProcessor.Entity.ORGANISATION.toString()));
+        assertThat(result.getEntityGroups().get(0).getLabel(), equalTo(NerProcessor.Entity.ORGANIZATION.toString()));
         assertThat(result.getEntityGroups().get(1).getWord(), equalTo("london"));
         assertThat(result.getEntityGroups().get(1).getLabel(), equalTo(NerProcessor.Entity.LOCATION.toString()));
     }
@@ -169,7 +169,7 @@ public class NerProcessorTests extends ESTestCase {
         assertThat(entityGroups.get(0).getWord(), equalTo("Sarah Jessica"));
         assertThat(entityGroups.get(1).getLabel(), equalTo("location"));
         assertThat(entityGroups.get(1).getWord(), equalTo("Manchester"));
-        assertThat(entityGroups.get(2).getLabel(), equalTo("organisation"));
+        assertThat(entityGroups.get(2).getLabel(), equalTo("organization"));
         assertThat(entityGroups.get(2).getWord(), equalTo("Elastic"));
     }
 
@@ -214,7 +214,7 @@ public class NerProcessorTests extends ESTestCase {
         assertThat(entityGroups.get(0).getWord(), equalTo("FirstName SecondName"));
         assertThat(entityGroups.get(1).getLabel(), equalTo("person"));
         assertThat(entityGroups.get(1).getWord(), equalTo("NextPerson NextPersonSecondName"));
-        assertThat(entityGroups.get(2).getLabel(), equalTo("organisation"));
+        assertThat(entityGroups.get(2).getLabel(), equalTo("organization"));
     }
 
     private static TokenizationResult tokenize(List<String> vocab, String input) {