# Path: newsApp/encodedEntity.py
# class EncodedEntity:
#   """
#   Represents a phonetically encoded entity
#   """
# 
#   def __init__(self, plainEntity):
#     """
#     Instantiates a new encoded entity object.
#     Requires 'plainEntity': plain text entity to encode
#     """
# 
#     self.plain = plainEntity
#     self.encoded = jellyfish.metaphone(plainEntity)


import os
import time
from boto.dynamodb2.table import Table
from boto.dynamodb2.fields import HashKey, RangeKey, GlobalAllIndex
from .dbhelper import *
from .encodedEntity import EncodedEntity
        Instantiates a new instance of EntityTableManager class
        """

        self.tableConnString = os.environ['ENTITYTABLE_CONNECTIONSTRING'];
        self.__table = None

    def __getTable(self):
        """
        Get the entity table.
        """

        if not self.__table:
            tableConnectionParams = parseConnectionString(
                self.tableConnString);

            self.__table = Table(
                tableConnectionParams['name'],
                connection = getDbConnection(tableConnectionParams));

        return self.__table;

    def __removeDuplicateEntities(self, entities):
        """
        Remove entities which might result in duplicate encodings.
        """

        seenEncodedEntities = set()
        uniqueEntitiesList = []

        for entity in entities:

# Path: newsApp/encodedEntity.py
# class EncodedEntity:
#   """
#   Represents a phonetically encoded entity
#   """
# 
#   def __init__(self, plainEntity):
#     """
#     Instantiates a new encoded entity object.
#     Requires 'plainEntity': plain text entity to encode
#     """
# 
#     self.plain = plainEntity
#     self.encoded = jellyfish.metaphone(plainEntity)


# Path: newsApp/entityTableManager.py
import os
import time
from boto.dynamodb2.table import Table
from boto.dynamodb2.fields import HashKey, RangeKey, GlobalAllIndex
from .dbhelper import *
from .encodedEntity import EncodedEntity

        Instantiates a new instance of EntityTableManager class
        """

        self.tableConnString = os.environ['ENTITYTABLE_CONNECTIONSTRING'];
        self.__table = None

    def __getTable(self):
        """
        Get the entity table.
        """

        if not self.__table:
            tableConnectionParams = parseConnectionString(
                self.tableConnString);

            self.__table = Table(
                tableConnectionParams['name'],
                connection = getDbConnection(tableConnectionParams));

        return self.__table;

    def __removeDuplicateEntities(self, entities):
        """
        Remove entities which might result in duplicate encodings.
        """

        seenEncodedEntities = set()
        uniqueEntitiesList = []

        for entity in entities:

            encodedEntity = EncodedEntity(entity).encoded