public SpeakerInfo(String speakerName) { this.speakerId = speakerName; int commaPos = speakerName.indexOf(','); if (commaPos > 0) { // drop everything after the , this.speakerName = speakerName.substring(0, commaPos); if (commaPos < speakerName.length()) { speakerDesc = speakerName.substring(commaPos+1); speakerDesc = speakerDesc.trim(); if (speakerDesc.isEmpty()) speakerDesc = null; } } else { this.speakerName = speakerName; } this.speakerNameStrings = WHITESPACE_PATTERN.split(this.speakerName); speakerIdIsNumber = NumberMatchingRegex.isDecimalInteger(speakerId); speakerIdIsAutoDetermined = DEFAULT_SPEAKER_PATTERN.matcher(speakerId).matches(); }
public SpeakerInfo(String speakerName) { this.speakerId = speakerName; int commaPos = speakerName.indexOf(','); if (commaPos > 0) { // drop everything after the , this.speakerName = speakerName.substring(0, commaPos); if (commaPos < speakerName.length()) { speakerDesc = speakerName.substring(commaPos+1); speakerDesc = speakerDesc.trim(); if (speakerDesc.isEmpty()) speakerDesc = null; } } else { this.speakerName = speakerName; } this.speakerNameStrings = WHITESPACE_PATTERN.split(this.speakerName); speakerIdIsNumber = NumberMatchingRegex.isDecimalInteger(speakerId); speakerIdIsAutoDetermined = DEFAULT_SPEAKER_PATTERN.matcher(speakerId).matches(); }
/** * Given the name of a speaker, returns the coref cluster id it belongs to (-1 if no cluster) * @param document The document to search in * @param speakerString The name to search for * @return cluster id */ public static int getSpeakerClusterId(Document document, String speakerString) { int speakerClusterId = -1; // try looking up cluster id from speaker info SpeakerInfo speakerInfo = null; if (speakerString != null) { speakerInfo = document.getSpeakerInfo(speakerString); if (speakerInfo != null) { speakerClusterId = speakerInfo.getCorefClusterId(); } } if (speakerClusterId < 0 && speakerString != null && NumberMatchingRegex.isDecimalInteger(speakerString)) { // speakerString is number so is mention id try { int speakerMentionId = Integer.parseInt(speakerString); Mention mention = document.allPredictedMentions.get(speakerMentionId); if (mention != null) { speakerClusterId = mention.corefClusterID; if (speakerInfo != null) speakerInfo.addMention(mention); } } catch (Exception e) { } } return speakerClusterId; }
/** * Given the name of a speaker, returns the coref cluster id it belongs to (-1 if no cluster) * @param document The document to search in * @param speakerString The name to search for * @return cluster id */ public static int getSpeakerClusterId(Document document, String speakerString) { int speakerClusterId = -1; // try looking up cluster id from speaker info SpeakerInfo speakerInfo = null; if (speakerString != null) { speakerInfo = document.getSpeakerInfo(speakerString); if (speakerInfo != null) { speakerClusterId = speakerInfo.getCorefClusterId(); } } if (speakerClusterId < 0 && speakerString != null && NumberMatchingRegex.isDecimalInteger(speakerString)) { // speakerString is number so is mention id try { int speakerMentionId = Integer.parseInt(speakerString); Mention mention = document.predictedMentionsByID.get(speakerMentionId); if (mention != null) { speakerClusterId = mention.corefClusterID; if (speakerInfo != null) speakerInfo.addMention(mention); } } catch (Exception e) { } } return speakerClusterId; }
if(NumberMatchingRegex.isDecimalInteger(speaker)) speaker = speaker + ": "+document.predictedMentionsByID.get(Integer.parseInt(speaker)).spanToString(); sentStr.append("\tspeaker: "+speaker+" ("+t.get(0).get(UtteranceAnnotation.class)+") "); String[] tokens = new String[t.size()];
if (NumberMatchingRegex.isDecimalInteger(speaker)) { try{ int speakerMentionID = Integer.parseInt(speaker);
log.info("speakers value: " + speakerID); log.info("mention for it: "+ ( (NumberMatchingRegex.isDecimalInteger(speakerID))? doc.predictedMentionsByID.get(Integer.parseInt(doc.speakers.get(utter))) : "no mention for this speaker yet") ); if (NumberMatchingRegex.isDecimalInteger(speaker)) { int speakerMentionID = Integer.parseInt(speaker); doc.speakerPairs.add(new Pair<>(m.mentionID, speakerMentionID)); log.info("speakers value: " + speakerID); log.info("mention for it: "+ ( (NumberMatchingRegex.isDecimalInteger(speakerID))? doc.predictedMentionsByID.get(Integer.parseInt(doc.speakers.get(utter))) : "no mention for this speaker yet") );
public SpeakerInfo(String speakerName) { this.speakerId = speakerName; int commaPos = speakerName.indexOf(','); if (commaPos > 0) { // drop everything after the , this.speakerName = speakerName.substring(0, commaPos); if (commaPos < speakerName.length()) { speakerDesc = speakerName.substring(commaPos+1); speakerDesc = speakerDesc.trim(); if (speakerDesc.isEmpty()) speakerDesc = null; } } else { this.speakerName = speakerName; } this.speakerNameStrings = WHITESPACE_PATTERN.split(this.speakerName); speakerIdIsNumber = NumberMatchingRegex.isDecimalInteger(speakerId); speakerIdIsAutoDetermined = DEFAULT_SPEAKER_PATTERN.matcher(speakerId).matches(); }
public SpeakerInfo(String speakerName) { this.speakerId = speakerName; int commaPos = speakerName.indexOf(','); if (commaPos > 0) { // drop everything after the , this.speakerName = speakerName.substring(0, commaPos); if (commaPos < speakerName.length()) { speakerDesc = speakerName.substring(commaPos+1); speakerDesc = speakerDesc.trim(); if (speakerDesc.isEmpty()) speakerDesc = null; } } else { this.speakerName = speakerName; } this.speakerNameStrings = WHITESPACE_PATTERN.split(this.speakerName); speakerIdIsNumber = NumberMatchingRegex.isDecimalInteger(speakerId); speakerIdIsAutoDetermined = DEFAULT_SPEAKER_PATTERN.matcher(speakerId).matches(); }
public SpeakerInfo(String speakerName) { this.speakerId = speakerName; int commaPos = speakerName.indexOf(','); if (commaPos > 0) { // drop everything after the , this.speakerName = speakerName.substring(0, commaPos); if (commaPos < speakerName.length()) { speakerDesc = speakerName.substring(commaPos+1); speakerDesc = speakerDesc.trim(); if (speakerDesc.isEmpty()) speakerDesc = null; } } else { this.speakerName = speakerName; } this.speakerNameStrings = WHITESPACE_PATTERN.split(this.speakerName); speakerIdIsNumber = NumberMatchingRegex.isDecimalInteger(speakerId); speakerIdIsAutoDetermined = DEFAULT_SPEAKER_PATTERN.matcher(speakerId).matches(); }
/** * Given the name of a speaker, returns the coref cluster id it belongs to (-1 if no cluster) * @param document The document to search in * @param speakerString The name to search for * @return cluster id */ public static int getSpeakerClusterId(Document document, String speakerString) { int speakerClusterId = -1; // try looking up cluster id from speaker info SpeakerInfo speakerInfo = null; if (speakerString != null) { speakerInfo = document.getSpeakerInfo(speakerString); if (speakerInfo != null) { speakerClusterId = speakerInfo.getCorefClusterId(); } } if (speakerClusterId < 0 && speakerString != null && NumberMatchingRegex.isDecimalInteger(speakerString)) { // speakerString is number so is mention id try { int speakerMentionId = Integer.parseInt(speakerString); Mention mention = document.allPredictedMentions.get(speakerMentionId); if (mention != null) { speakerClusterId = mention.corefClusterID; if (speakerInfo != null) speakerInfo.addMention(mention); } } catch (Exception e) { } } return speakerClusterId; }
/** * Given the name of a speaker, returns the coref cluster id it belongs to (-1 if no cluster) * @param document The document to search in * @param speakerString The name to search for * @return cluster id */ public static int getSpeakerClusterId(Document document, String speakerString) { int speakerClusterId = -1; // try looking up cluster id from speaker info SpeakerInfo speakerInfo = null; if (speakerString != null) { speakerInfo = document.getSpeakerInfo(speakerString); if (speakerInfo != null) { speakerClusterId = speakerInfo.getCorefClusterId(); } } if (speakerClusterId < 0 && speakerString != null && NumberMatchingRegex.isDecimalInteger(speakerString)) { // speakerString is number so is mention id try { int speakerMentionId = Integer.parseInt(speakerString); Mention mention = document.predictedMentionsByID.get(speakerMentionId); if (mention != null) { speakerClusterId = mention.corefClusterID; if (speakerInfo != null) speakerInfo.addMention(mention); } } catch (Exception e) { } } return speakerClusterId; }
/** * Given the name of a speaker, returns the coref cluster id it belongs to (-1 if no cluster) * @param document The document to search in * @param speakerString The name to search for * @return cluster id */ public static int getSpeakerClusterId(Document document, String speakerString) { int speakerClusterId = -1; // try looking up cluster id from speaker info SpeakerInfo speakerInfo = null; if (speakerString != null) { speakerInfo = document.getSpeakerInfo(speakerString); if (speakerInfo != null) { speakerClusterId = speakerInfo.getCorefClusterId(); } } if (speakerClusterId < 0 && speakerString != null && NumberMatchingRegex.isDecimalInteger(speakerString)) { // speakerString is number so is mention id try { int speakerMentionId = Integer.parseInt(speakerString); Mention mention = document.allPredictedMentions.get(speakerMentionId); if (mention != null) { speakerClusterId = mention.corefClusterID; if (speakerInfo != null) speakerInfo.addMention(mention); } } catch (Exception e) { } } return speakerClusterId; }
if(NumberMatchingRegex.isDecimalInteger(speaker)) speaker = speaker + ": "+document.predictedMentionsByID.get(Integer.parseInt(speaker)).spanToString(); sentStr.append("\tspeaker: "+speaker+" ("+t.get(0).get(UtteranceAnnotation.class)+") "); String[] tokens = new String[t.size()];
if (NumberMatchingRegex.isDecimalInteger(speaker)) { try{ int speakerMentionID = Integer.parseInt(speaker);
if (NumberMatchingRegex.isDecimalInteger(speaker)) { try{ int speakerMentionID = Integer.parseInt(speaker);
log.info("speakers value: " + speakerID); log.info("mention for it: "+ ( (NumberMatchingRegex.isDecimalInteger(speakerID))? doc.predictedMentionsByID.get(Integer.parseInt(doc.speakers.get(utter))) : "no mention for this speaker yet") ); if (NumberMatchingRegex.isDecimalInteger(speaker)) { int speakerMentionID = Integer.parseInt(speaker); doc.speakerPairs.add(new Pair<>(m.mentionID, speakerMentionID)); log.info("speakers value: " + speakerID); log.info("mention for it: "+ ( (NumberMatchingRegex.isDecimalInteger(speakerID))? doc.predictedMentionsByID.get(Integer.parseInt(doc.speakers.get(utter))) : "no mention for this speaker yet") );