Attribute VB_Name = "ParserDeclarations"
' ======== Parser declarations ========
' Shared module version: 20220614
' Tested in:
' Depends on:
' Required reference:
Option Private Module
Option Explicit

Public Const LOCAL_MODELS = "C:\Tools\models"
Public Const MODEL_ACTION_VERBS = "ActionVerbs.txt"

Public Const CUSTOM_ERROR_DEBUG = 1025

Public Enum TDetector
  [_First] = 1
  
  T_DETECTOR_UNKNOWN = 0
  T_DETECTOR_REGEX = 1
  T_DETECTOR_MORPHO = 2
  T_DETECTOR_LIST = 3
  T_DETECTOR_DATE = 4
  T_DETECTOR_ACTION = 5
  T_DETECTOR_NPA = 6
  T_DETECTOR_BASIC_NER = 7
  
  [_Last] = 7
End Enum

Public Function DetectorFromStr(sName$) As TDetector
  Select Case sName
  Case "Дата":        DetectorFromStr = T_DETECTOR_DATE
  Case "Действие":    DetectorFromStr = T_DETECTOR_ACTION
  Case "Список слов": DetectorFromStr = T_DETECTOR_LIST
  Case "RegExp":      DetectorFromStr = T_DETECTOR_REGEX
  Case "Морфология":  DetectorFromStr = T_DETECTOR_MORPHO
  Case "НПА":         DetectorFromStr = T_DETECTOR_NPA
  Case "Им. сущности": DetectorFromStr = T_DETECTOR_BASIC_NER
  Case Else: DetectorFromStr = T_DETECTOR_UNKNOWN
  End Select
End Function

Public Function DetectorToStr(iType As TDetector) As String
  Select Case iType
  Case T_DETECTOR_UNKNOWN:  DetectorToStr = "Неопределенная"
  Case T_DETECTOR_DATE:     DetectorToStr = "Дата"
  Case T_DETECTOR_ACTION:   DetectorToStr = "Действие"
  Case T_DETECTOR_LIST:     DetectorToStr = "Список слов"
  Case T_DETECTOR_REGEX:    DetectorToStr = "RegExp"
  Case T_DETECTOR_MORPHO:   DetectorToStr = "Морфология"
  Case T_DETECTOR_NPA:      DetectorToStr = "НПА"
  Case T_DETECTOR_BASIC_NER: DetectorToStr = "Им. сущности"
  End Select
End Function
