| | |
| | | |
| | | 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!"); |
| | |
| | | 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)); |
| | | } |
| | | } |
| | | } |
| | |
| | | this.wordList.add(wm); |
| | | this.total++; |
| | | } |
| | | |
| | | |
| | | public String getSrcText(){ |
| | | return this.srcText; |
| | | } |
| | | |
| | | |
| | | public List<WordMeta> getWordMetaList(){ |
| | | return this.wordList; |
| | | } |
| | |
| | | public int getTotal() { |
| | | return total; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 返回词元的map对象,key = 单词 |
| | | * @return |
| | |
| | | public Map<String, WordMeta> getWordMetaMap(){ |
| | | return this.wordMetaCache; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 返回语句的长度 |
| | | * @return |
| | |
| | | public int getTextLength(){ |
| | | return this.srcText.length(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据索引返回单词词元 |
| | | * @param index |
| | |
| | | } |
| | | return this.wordList.get(index); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public String toString(){ |
| | | return this.wordList.toString(); |