NAME
Lingua::Generic::Interface::Base - base module used by language independent linguistic interfaces
VERSION
version v0.03
SYNOPSIS
use parent 'Lingua::Generic::Interface::Base';
(since v0.03)
This module implements te base package for language independent linguistic interfaces such as Lingua::Generic::Interface::Word.
This module provides a base implementation for some of it's methods. Methods which this module cannot provide a useful default implementation for will have an implementation that dies on call.
This module inherits from Data::Identifier::Interface::Simple, and Data::Identifier::Interface::Subobjects.
Packages that inherit from this package may also want to implement Data::Identifier::Interface::Known.
METHODS
as_string
my $str = $word->as_string;
(since v0.03)
Returns the string representation of the word.
Default implementation
The default implementation will return the string value from the key string.
displayname
my $displayname = $base->displayname;
(since v0.03)
This method returns a string suitable to display to the user.
This is the same as "displayname" in Data::Identifier::Interface::Simple.
Default implementation
The default implementation is compatible with "displayname" in Data::Identifier::Interface::Simple. It will make use of "as_string" as good as possible, then fall back to calling "as" asking for a Data::Identifier to handle the request.
ise
my $ise = $base->ise(...)
(since v0.03)
This is the same as "ise" in Data::Identifier::Interface::Simple.
If an implementations implement this method or "as" in Data::Identifier::Interface::Simple as their primary method to create Data::Identifier objects this method might be overridden by the default implementation from Data::Identifier::Interface::Simple such as by:
sub ise { goto &Data::Identifier::Interface::Simple::ise } # overridden using tail-call
Default implementation
The default implementation will die.
eq
my $bool = $base->eq($other); # $base must be non-undef
(since v0.03)
Compares two objects to be equal.
If both objects are undef they are considered equal.
The operators "eq" in perlop and "ne" in perlop are overloaded to this method.
Default implementation
The default implementation checks if both objects are identical. It may also check other attributes. All packages that inherit from this should override this method to something matching their domain's definition of equal.
RESERVED METHODS
The following methods are reserved for future use and or use by any interface under Lingua::Generic::Interface:
- attribute
- as_number
- as_string
- classes_of
- cmp
- combine
- concept
- concepts
- eq
- flags
- get
- has_roles
- has_type
- language
- markers
- modifiers
- natural_language
- new
- parts
- prefix
- property
- register
- role
- roles
- stem
- suffix
- tagname
- type
- words
- _*_provider
Also the methods from the following interfaces are reserved for their designated usages: Data::Identifier::Interface::Known.
AUTHOR
Philipp Schafft <lion@cpan.org>
COPYRIGHT AND LICENSE
This software is Copyright (c) 2026 by Philipp Schafft <lion@cpan.org>.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)