shikeying
2024-03-26 65c1714039bfe31b748e10ca5fb7c0b78a4829e5
walker-text-semantics/src/main/java/com/walker/semantics/InputWord.java
@@ -20,19 +20,19 @@
   private String srcText;
   private List<WordMeta> wordList = new ArrayList<>(8);
   private int total = 0;   // 总分词数量(包含重复的)
//   // 以下为分析语义使用的属性
//   // 是否存在时间词,据此可决定是否解析时间
//   private boolean hasWordTime = false;
   // 添加属性,用于根据词的名称查找元数据,2020-12-23
   private Map<String, WordMeta> wordMetaCache = new HashMap<>(16);
   private int sceneContextId = 0;
   private String user;
   public InputWord(String srcWords){
      if(SemanticsUtils.isEmpty(srcWords)){
         throw new IllegalArgumentException("srcWords is required!");
@@ -46,6 +46,9 @@
         sp = SpeechPart.toSpeechPart(t.getNatureStr());
         if(sp.isFocus()){
            this.addWordMeta(new WordMeta(t.getName(), sp));
         } else {
//            System.out.println("不关注的词:" + t.getName());
//            this.addWordMeta(new WordMeta(t.getName(), sp));
         }
      }
   }
@@ -60,11 +63,11 @@
      this.wordList.add(wm);
      this.total++;
   }
   public String getSrcText(){
      return this.srcText;
   }
   public List<WordMeta> getWordMetaList(){
      return this.wordList;
   }
@@ -76,7 +79,7 @@
   public int getTotal() {
      return total;
   }
   /**
    * 返回词元的map对象,key = 单词
    * @return
@@ -84,7 +87,7 @@
   public Map<String, WordMeta> getWordMetaMap(){
      return this.wordMetaCache;
   }
   /**
    * 返回语句的长度
    * @return
@@ -92,7 +95,7 @@
   public int getTextLength(){
      return this.srcText.length();
   }
   /**
    * 根据索引返回单词词元
    * @param index
@@ -104,7 +107,7 @@
      }
      return this.wordList.get(index);
   }
   @Override
   public String toString(){
      return this.wordList.toString();