All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.kotlinnlp.syntaxdecoder.modules.featuresextractor.FeaturesExtractorTrainable.kt Maven / Gradle / Ivy

Go to download

SyntaxDecoder is a generalized transition-based parsing framework designed to simplify the development of statistical transition-based dependency parsers.

The newest version!
/* Copyright 2017-present The KotlinNLP Authors. All Rights Reserved.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 * ------------------------------------------------------------------*/

package com.kotlinnlp.syntaxdecoder.modules.featuresextractor

import com.kotlinnlp.syntaxdecoder.transitionsystem.Transition
import com.kotlinnlp.syntaxdecoder.utils.Updatable
import com.kotlinnlp.syntaxdecoder.modules.featuresextractor.features.Features
import com.kotlinnlp.syntaxdecoder.utils.scheduling.BatchScheduling
import com.kotlinnlp.syntaxdecoder.utils.scheduling.EpochScheduling
import com.kotlinnlp.syntaxdecoder.utils.scheduling.ExampleScheduling
import com.kotlinnlp.syntaxdecoder.context.InputContext
import com.kotlinnlp.syntaxdecoder.transitionsystem.state.State
import com.kotlinnlp.syntaxdecoder.context.items.StateItem
import com.kotlinnlp.syntaxdecoder.modules.supportstructure.DecodingSupportStructure
import com.kotlinnlp.syntaxdecoder.utils.DecodingContext

/**
 * The trainable [FeaturesExtractor].
 */
abstract class FeaturesExtractorTrainable<
  StateType : State,
  TransitionType : Transition,
  InputContextType : InputContext,
  ItemType : StateItem,
  FeaturesType : Features<*, *>,
  in SupportStructureType : DecodingSupportStructure>
  :
  FeaturesExtractor(),
  ExampleScheduling,
  BatchScheduling,
  EpochScheduling,
  Updatable {

  /**
   * Backward errors through this [FeaturesExtractor], starting from the errors of the features contained in the given
   * [decodingContext].
   * Errors are required to be already set into the given features.
   *
   * @param decodingContext the decoding context that contains extracted features with their errors
   * @param supportStructure the decoding support structure
   */
  abstract fun backward(
    decodingContext: DecodingContext,
    supportStructure: SupportStructureType)
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy