import abc

class HyphenationRule(object):
    '''
    An interface that describes the required functionality for a hyphenation rule
    to be used by the class RuleBasedHyphenator. The interface requires only one
    method to be implemented : next_hyphen, which should return the next
    hyphenation position given a word and the position of the previous hyphen or
    0 (the beginning of the word).
    '''

    NOT_APPLICABLE = -2
    
    # next_hyphen should return the value of this constant if a rule cannot be
    # applied at the given position.
    
    @abc.abstractmethod
    def next_hyphen(self, word, previous_hyphen_at):
        '''
        Returns the next hyphen for the given word starting at the given
        location.
        
        @param word: the word to hyphenate
        @param previous_hyphen_at: the position of the previous hyphen
        @type: integer
        
        @return: the position of the next hyphen or NOT_APPLICABLE if the rule
                cannot be applied here.
        '''
