#
# <one line to give the library's name and an idea of what it does.>
# Copyright (C) 2015  <copyright holder> <email>
# 
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# 
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
# 
#

import mergerinterface
from grafon import constants

class SUMOMappingInterface(mergerinterface.MergerInterface):
  def __init__(self, bg, str_name):
    super(SUMOMappingInterface, self).__init__(str_name, bg)

  def get_concepts_for_token(self, token):
    """!
    For a given token returns concepts which are connected with it. 
    If the token dont have informatoion about concept returns None value.
    There the output of mapping plwordnet onto SUMO is taken into account.

    @para token: corpus2.Token
    @return List of concepts with information about type of mapping relation
            or None if identifier do not exists.
    """
    token_md = token.get_metadata()
    if not token_md:
      return None
    sense_md = token_md.get_attribute(constants.TOKEN_SUMO_MAP)
    return sense_md.split(constants.CCL_MULIMAP_SUMO_SEP) if sense_md else None