# Configure the Fact Bank System

The Answer Server configuration file contains information about the subcomponents in your Fact Bank systems.

For any Fact Bank system, you must configure the name of your Question Parser and time normalization Eduction grammars and Lua scripts, and the locations of the Fact Bank coding files. You must also configure the Fact Store.

You can optionally also configure a second Eduction grammar for advanced time normalization. Advanced time normalization extracts dates and times in various formats from questions and normalize them to a consistent format, to improve fact retrieval.

The Fact Store component stores the facts that you want to be able to retrieve. The Fact Store content is structured data, containing the entities and properties for your facts. As such, Micro Focus recommends that you use a SQL database as the backend component for your fact store, because it is optimized for querying structured content.

Alternatively, you can use a Lua script to retrieve facts from an external fact store.

You specify the type of Fact Store that you want to use by configuring the `BackendType` configuration parameter in the system configuration section in the Answer Server configuration file. Depending on which back end type you choose, you must also set additional configuration parameters.

The following sections describe how to configure the Fact Bank system in Answer Server, depending on the type of Fact Store you choose.

DEPRECATED: In earlier versions of Answer Server you could use an IDOL Content component fact store. This option is deprecated in Answer Server version 11.5 and later. Micro Focus recommends that you use a SQL database as your fact store.

The IDOL Content component fact store option is still available for existing implementations, but it might be incompatible with new functionality. For information about how to set up the IDOL Content component fact store, refer to the documentation for Answer Server version 11.4.

## Configure a Fact Bank with a SQL Database Fact Store

The following procedure describes the Answer Server configuration you need to set up a Fact Bank system with a SQL database back end. For information about how to set up the SQL database, see Set Up a SQL Backend as Fact Store.

To configure the Fact Bank System for a SQL database backend

1. Open the Answer Server configuration file in a text editor.

2. Find the `[Systems]` section, or create one if it does not exist. This section contains a list of systems, which refer to the associated configuration sections for each system.

3. After any existing systems, add an entry for your new Fact Bank system. For example:

       [Systems]
       0=MyAnswerBank
       1=MyFactBank

4. Create a configuration section for your Fact Bank system, with the name that you specified. For example, `[MyFactBank]`.

5. Set `Type` to `FactBank`.

6. Set `BackendType` to `sqldb`.

7. Set `ConnectionString` to the connection string to use to connect to the RDBMS that contains the fact store content.

8. Set `EductionQuestionGrammars` to the name of your question parser grammar. You can also optionally set `EductionEntities` to a list of entities to use from the specified grammars.

9. Set `EductionTimeGrammars` to the name of the Eduction grammar to use for advanced time normalization. You can also optionally set `TimeEntities` to a list of entities to use from the specified grammars.

10. Set `EductionLuaScript` and `TimeLuaScript` to the file name and path to the Lua scripts to use for question parsing and time normalization.

11. Specify how Fact Bank must access your coding files by using one of the following methods:

    - To use coding text files (see Create Coding Files):

      1. Set `CodifierType` to `files`.
      2. Set `CodingsPath` and `CodingsDatPath` to the locations of the coding files.

    - To use a coding database (see Set up a SQL Database for Coding Information):

      1. Set `CodifierType` to `odbc`.
      2. Set `CodingsConfigSection` to the name of a configuration section where you define the connection information your coding database.
      3. Create the corresponding configuration section for the coding database (for example `[FactBankCodings0]`).
      4. In this coding database configuration section, set `ConnectionString` to the connection string to use to connect to the RDBMS that contains the coding information.

12. (Optional) Set the parameter `AskParallelizationFactor` to specify the number of threads to use to gather answers (for each `ask` action). The default value is `1` but if your Answer Server has sufficient resources you can improve response times by increasing the number.

13. Save and close the configuration file.

14. Restart Answer Server for your changes to take effect.

For example:

    [MyFactBank]
    Type=factbank
    AskParallelizationFactor=4
    // Question Parser
    EductionQuestionGrammars=./resources/grammars/question_grammar_en.ecr
    EductionLuaScript=./resources/lua/question_grammar_en.lua
    EductionTimeGrammars=./resources/grammars/datetime_processing.ecr
    TimeLuaScript=./resources/lua/datetime.lua
    // Fact Store
    BackendType=sqldb
    ConnectionString=Driver={PostgreSQL};Server=sql-host.mycompany.com;Port=5432;Database=factstoredb;Uid=postgres;password=password;
    // Coding Files
    CodingsPath=./codings
    CodingsDatPath=./codings

## Configure a Fact Bank to Call a Lua Script

The following procedure describes the Answer Server configuration you need to set up a Fact Bank system to call a Lua script to retrieve facts. For information about how to write the script, see Use a Lua Scripts to Retrieve Facts and the Answer Server Reference.

To configure the Fact Bank system for a Lua Script backend

1. Open the Answer Server configuration file in a text editor.

2. Find the `[Systems]` section, or create one if it does not exist. This section contains a list of systems, which refer to the associated configuration sections for each system.

3. After any existing systems, add an entry for your new Fact Bank system. For example:

       [Systems]
       0=MyAnswerBank
       1=MyFactBank

4. Create a configuration section for your Fact Bank system, with the name that you specified. For example, `[MyFactBank]`.

5. Set `Type` to `FactBank`.

6. Set `BackendType` to `Lua`.

7. Set `ScriptPath` to the path to the Lua script that you want to run as your Fact Bank. Answer Server calls out to this script whenever it processes an `Ask` action that includes the Lua Fact Bank system, and returns the response as an answer.

8. (Optional) Set `ScriptFunction` to the entry function in your Lua script that Answer Server must call. The default entry function is called `fetch`.

9. Set `EductionQuestionGrammars` to the name of your question parser grammar. You can also optionally set `EductionEntities` to a list of entities to use from the specified grammars.

10. Set `EductionTimeGrammars` to the name of the Eduction grammar to use for advanced time normalization. You can also optionally set `TimeEntities` to a list of entities to use from the specified grammars.

11. Set `EductionLuaScript` and `TimeLuaScript` to the file name and path to the Lua scripts to use for question parsing and time normalization.

12. Specify how Fact Bank must access your coding files by using one of the following methods:

    - To use coding text files (see Create Coding Files):

      1. Set `CodifierType` to `files`.
      2. Set `CodingsPath` and `CodingsDatPath` to the locations of the coding files.

    - To use a coding database (see Set up a SQL Database for Coding Information):

      1. Set `CodifierType` to `odbc`.
      2. Set `CodingsConfigSection` to the name of a configuration section where you define the connection information your coding database.
      3. Create the corresponding configuration section for the coding database (for example `[FactBankCodings0]`).
      4. In this coding database configuration section, set `ConnectionString` to the connection string to use to connect to the RDBMS that contains the coding information.

13. (Optional) Set the parameter `AskParallelizationFactor` to specify the number of threads to use to gather answers (for each `ask` action). The default value is `1` but if your Answer Server has sufficient resources you can improve response times by increasing the number.

14. Save and close the configuration file.

15. Restart Answer Server for your changes to take effect.

_FT_HTML5_bannerTitle.htm