Java Code Examples for com.esotericsoftware.minlog.Log#debug()

The following examples show how to use com.esotericsoftware.minlog.Log#debug() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FreddyModuleBase.java    From freddy with GNU Affero General Public License v3.0 6 votes vote down vote up
/*******************
 * Handle Collaborator server interactions for this module.
 *
 * @param interaction The Collaborator interaction object.
 * @return True if the interaction was generated and handled by this module.
 ******************/
public boolean handleCollaboratorInteraction(IBurpCollaboratorInteraction interaction) {
    String interactionId = interaction.getProperty("interaction_id");
    boolean result = false;
    Iterator<CollaboratorRecord> iterator = _collabRecords.iterator();
    while (iterator.hasNext()) {
        CollaboratorRecord record = iterator.next();
        if (record.getCollaboratorId().equals(interactionId)) {
            try {
                _callbacks.addScanIssue(createCollaboratorIssue(record, interaction));
            } catch (Exception ex) {
                Log.debug("FreddyModuleBase[" + _targetName + "]::handleCollaboratorInteraction() exception: " + ex.getMessage());
            }
            iterator.remove();
            result = true;
        }
    }

    return result;
}
 
Example 2
Source File: PretrainedCharacterVectors.java    From JedAIToolkit with Apache License 2.0 6 votes vote down vote up
float[] createCharacterWordVector(String token) {
    float[] char_word_vector = getZeroVector();
    int num_token_chars = 0;
    int char_idx = 0;
    for (char c : token.toCharArray()) {
        char_idx++;
        if (elementMap.containsKey(Character.toString(c))) {
            Log.debug(String.format("Adding char %d/%d : %c from token %s to vector.", char_idx, token.length(), c, token));
            num_token_chars++;
            addCharacterVector(elementMap.get(Character.toString(c)), char_word_vector);
        } else {
            handleUnknown(token);
        }
    }
    if (num_token_chars == 0) {
        return null;
    }
    // normalize
    Log.debug(String.format("Averaging character embedding from %d characters", num_token_chars));
    for (int i = 0; i < dimension; ++i) {
        char_word_vector[i] /= num_token_chars;
    }
    return char_word_vector;

}
 
Example 3
Source File: GenerateBoards.java    From storm-example with Apache License 2.0 6 votes vote down vote up
@Override
public void execute(TridentTuple tuple, TridentCollector collector) {
    GameState gameState = (GameState) tuple.get(0);
    Board currentBoard = gameState.getBoard();
    List<Board> history = new ArrayList<Board>();
    history.addAll(gameState.getHistory());
    history.add(currentBoard);

    if (!currentBoard.isEndState()) {
        String nextPlayer = Player.next(gameState.getPlayer());
        List<Board> boards = gameState.getBoard().nextBoards(nextPlayer);
        Log.debug("Generated [" + boards.size() + "] children boards for [" + gameState.toString() + "]");
        for (Board b : boards) {
            GameState newGameState = new GameState(b, history, nextPlayer);
            List<Object> values = new ArrayList<Object>();
            values.add(newGameState);
            collector.emit(values);
        }
    } else {
        Log.debug("End game found! [" + currentBoard + "]");
    }
}
 
Example 4
Source File: PretrainedWordVectors.java    From JedAIToolkit with Apache License 2.0 5 votes vote down vote up
/**
 * Updates the model with the input text. Tokenizes, maps each token to the aggregate vector.
 * @param text
 */
@Override
public void updateModel(String text) {
    int localUpdates=0;
    final String[] tokens = text.toLowerCase().split("[\\W_]");
    for (String token : tokens){
        if (PretrainedWordVectors.elementMap.containsKey(token)){
            addVector(elementMap.get(token));
            localUpdates ++;
        }
        else
            handleUnknown(token);
    }
    Log.debug("Used " + localUpdates + " element(s) from [text]: [" + text + "]");
}
 
Example 5
Source File: PretrainedVectors.java    From JedAIToolkit with Apache License 2.0 5 votes vote down vote up
/**
 * Normalizes to the number of words in the text collection (as part of the arithmetic mean aggregation)
 */
@Override
public void finalizeModel() {
    if (numElements > 0) {
        // produce average
        for (int i = 0; i < dimension; ++i)
            aggregateVector[i] /= numElements;
    }
    Log.debug(String.format("Finalizing embedding with vectors of %d words.", numElements));
}
 
Example 6
Source File: PretrainedCharacterVectors.java    From JedAIToolkit with Apache License 2.0 5 votes vote down vote up
/**
 * Updates the model with the input text. Tokenizes, maps each token to the
 * aggregate vector.
 *
 * @param text
 */
@Override
public void updateModel(String text) {
    int localUpdates = 0;
    final String[] tokens = text.toLowerCase().split("[\\W_]");
    for (String token : tokens) {
        float[] wordVector = createCharacterWordVector(token);
        if (wordVector != null) {
            addVector(wordVector);
        }
        localUpdates++;
    }
    Log.debug("Used " + localUpdates + " element(s) from [text]: [" + text + "]");
}
 
Example 7
Source File: LocalQueuerFunction.java    From storm-example with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
@Override
public void execute(TridentTuple tuple, TridentCollector collector) {
    T object = (T) tuple.get(0);
    Log.debug("Queueing [" + object + "]");
    this.emitter.enqueue(object);
}