+
    ÖÇÜh¯î  ã                   óÞ  € R t  ^ RIt^ RIt^ RIt^ RIHt ^ RIHt ^ RI	H
t
HtHt ^ RIHtHtHt ^ RIHtHtHt ^ RIHt ^ RIHt ^ R	IHt R
t ! R R]4      t]t ! R R4      t ! R R]4      t ! R R]4      t  ! R R] 4      t! ! R R] 4      t" ! R R]4      t#R'R lt$R t%R t&R'R lt'R t(R t)R(R lt* ! R  R!]4      t+R" t,R)R# lt-R$ t.R% t/]0R&8X  d
   ]/! 4        R# R#   ] d     Lãi ; i)*aä  
A classifier model based on maximum entropy modeling framework.  This
framework considers all of the probability distributions that are
empirically consistent with the training data; and chooses the
distribution with the highest entropy.  A probability distribution is
"empirically consistent" with a set of training data if its estimated
frequency with which a class and a feature vector value co-occur is
equal to the actual frequency in the data.

Terminology: 'feature'
======================
The term *feature* is usually used to refer to some property of an
unlabeled token.  For example, when performing word sense
disambiguation, we might define a ``'prevword'`` feature whose value is
the word preceding the target word.  However, in the context of
maxent modeling, the term *feature* is typically used to refer to a
property of a "labeled" token.  In order to prevent confusion, we
will introduce two distinct terms to disambiguate these two different
concepts:

  - An "input-feature" is a property of an unlabeled token.
  - A "joint-feature" is a property of a labeled token.

In the rest of the ``nltk.classify`` module, the term "features" is
used to refer to what we will call "input-features" in this module.

In literature that describes and discusses maximum entropy models,
input-features are typically called "contexts", and joint-features
are simply referred to as "features".

Converting Input-Features to Joint-Features
-------------------------------------------
In maximum entropy models, joint-features are required to have numeric
values.  Typically, each input-feature ``input_feat`` is mapped to a
set of joint-features of the form:

|   joint_feat(token, label) = { 1 if input_feat(token) == feat_val
|                              {      and label == some_label
|                              {
|                              { 0 otherwise

For all values of ``feat_val`` and ``some_label``.  This mapping is
performed by classes that implement the ``MaxentFeatureEncodingI``
interface.
N)Údefaultdict)ÚClassifierI)Ú
call_megamÚparse_megam_weightsÚwrite_megam_file)Ú	call_tadmÚparse_tadm_weightsÚwrite_tadm_file)ÚCutoffCheckerÚaccuracyÚlog_likelihood)Úgzip_open_unicode)ÚDictionaryProbDist)ÚOrderedDictz
epytext enc                   óŒ   a € ] tR t^Nt o RtRR ltR tR tR tR t	R t
RR ltRR	 ltRR
 ltR t. ROt]RR l4       tRtV tR# )ÚMaxentClassifieraº  
A maximum entropy classifier (also known as a "conditional
exponential classifier").  This classifier is parameterized by a
set of "weights", which are used to combine the joint-features
that are generated from a featureset by an "encoding".  In
particular, the encoding maps each ``(featureset, label)`` pair to
a vector.  The probability of each label is then computed using
the following equation::

                            dotprod(weights, encode(fs,label))
  prob(fs|label) = ---------------------------------------------------
                   sum(dotprod(weights, encode(fs,l)) for l in labels)

Where ``dotprod`` is the dot product::

  dotprod(a,b) = sum(x*y for (x,y) in zip(a,b))
c                ój   € Wn         W n        W0n        VP                  4       \	        V4      8X  g   Q hR# )a  
Construct a new maxent classifier model.  Typically, new
classifier models are created using the ``train()`` method.

:type encoding: MaxentFeatureEncodingI
:param encoding: An encoding that is used to convert the
    featuresets that are given to the ``classify`` method into
    joint-feature vectors, which are used by the maxent
    classifier model.

:type weights: list of float
:param weights:  The feature weight vector for this classifier.

:type logarithmic: bool
:param logarithmic: If false, then use non-logarithmic weights.
N)Ú	_encodingÚ_weightsÚ_logarithmicÚlengthÚlen)ÚselfÚencodingÚweightsÚlogarithmics   &&&&Ú6/usr/lib/python3/dist-packages/nltk/classify/maxent.pyÚ__init__ÚMaxentClassifier.__init__a   s-   € ð" "ŒØŒØ'Ôà�‰Ó ¤C¨£LÔ0Ð0Ò0ó    c                ó6   € V P                   P                  4       # ©N)r   Úlabels©r   s   &r   r"   ÚMaxentClassifier.labelsx   s   € Ø�~‰~×$Ñ$Ó&Ð&r   c                óf   € Wn         V P                  P                  4       \        V4      8X  g   Q hR# )zˆ
Set the feature weight vector for this classifier.
:param new_weights: The new feature weight vector.
:type new_weights: list of float
N)r   r   r   r   )r   Únew_weightss   &&r   Úset_weightsÚMaxentClassifier.set_weights{   s)   € ð $ŒØ�~‰~×$Ñ$Ó&¬#¨kÓ*:Ô:Ð:Ò:r   c                ó   € V P                   # )zO
:return: The feature weight vector for this classifier.
:rtype: list of float
)r   r#   s   &r   r   ÚMaxentClassifier.weights„   s   € ð
 �}‰}Ðr   c                ó@   € V P                  V4      P                  4       # r!   )Úprob_classifyÚmax)r   Ú
featuresets   &&r   ÚclassifyÚMaxentClassifier.classify‹   s   € Ø×!Ñ! *Ó-×1Ñ1Ó3Ð3r   c                ó˜  € / pV P                   P                  4        F”  pV P                   P                  W4      pV P                  '       d4   R pV F%  w  rgWPP                  V,          V,          ,          pK'  	  WRV&   Kc  RpV F%  w  rgW€P                  V,          V,          ,          pK'  	  W‚V&   K–  	  \        W P                  RR7      # )g        ç      ð?T)ÚlogÚ	normalize)r   r"   Úencoder   r   r   )	r   r.   Ú	prob_dictÚlabelÚfeature_vectorÚtotalÚf_idÚf_valÚprods	   &&       r   r,   ÚMaxentClassifier.prob_classifyŽ   s³   € Øˆ	Ø—^‘^×*Ñ*Ö,ˆEØ!Ÿ^™^×2Ñ2°:ÓEˆNà× × Ð Ø�Û#1‘K�DØŸ]™]¨4Õ0°5Õ8Õ8’Eñ $2à#(˜%Ó ð �Û#1‘K�DØŸM™M¨$Õ/°5Õ8Õ8’Dñ $2à#'˜%Ó ñ -ô  " )×1BÑ1BÈdÔSÐSr   c           	     ó€  a aa€ ^2pR\        V^,
          4      ,           R,           pS P                  V4      o\        SP                  4       SP                  RR7      pVRV p\        RP                  V4      RP                  R V 4       4      ,           4       \        R	R
V^,
          ^\        V4      ,          ,           ,          ,           4       \        \        4      o\        V4       EF$  w  rgS P                  P                  W4      pVP                  V 3R lRR7       V Fæ  w  ršS P                  '       d   S P                   V	,          V
,          pMS P                   V	,          V
,          pS P                  P#                  V	4      pVP%                  R4      ^ ,          pVRV
,          ,          p\        V4      ^/8”  d   VR,          R,           p\        WLV^,          R,          V3,          4       SV;;,          V,          uu&   Kè  	  EK'  	  \        R	R
V^,
          ^\        V4      ,          ,           ,          ,           4       \        RP                  V4      RP                  V3R lV 4       4      ,           4       \        RP                  V4      RP                  V3R lV 4       4      ,           4       R# )z«
Print a table showing the effect of each of the features in
the given feature set, and how they combine to determine the
probabilities of each label for that featureset.
z  %-zs%s%8.3fT©ÚkeyÚreverseNz	  FeatureÚ c              3   óP   "  € T F  pR RV,          R,          ,          x € K  	  R# 5i)z%8sú%s:Né   NN© )Ú.0Úls   & r   Ú	<genexpr>Ú+MaxentClassifier.explain.<locals>.<genexpr>°   s    é € Ð?¹°1�e  q¥¨"�~×.Ò.»ùs   ‚$&z  Ú-c                 óJ   <€ \        SP                  V ^ ,          ,          4      # )é    ©Úabsr   )Úfid__r   s   &€r   Ú<lambda>Ú*MaxentClassifier.explain.<locals>.<lambda>·   s   ø€ ¤# d§m¡m°E¸!µHÕ&=Ô">r   ú and label is z (%s):Né,   Nz...Ú z  TOTAL:c              3   óD   <"  € T F  pR SV,          ,          x € K  	  R# 5i©z%8.3fNrF   )rG   rH   Úsumss   & €r   rI   rJ   Ç   s   øé € Ð3VÉvÈ!°G¸dÀ1½g×4EÒ4EËvùs   ƒ z  PROBS:c              3   óT   <"  € T F  pR SP                  V4      ,          x € K  	  R# 5irW   )Úprob)rG   rH   Úpdists   & €r   rI   rJ   Ë   s!   øé € Ð>±v°!�g §
¡
¨1£×-Ò-³vùs   ƒ%()Ústrr,   ÚsortedÚsamplesrZ   ÚprintÚljustÚjoinr   r   ÚintÚ	enumerater   r5   Úsortr   r   ÚdescribeÚsplit)r   r.   ÚcolumnsÚdescr_widthÚTEMPLATEr"   Úir7   r8   r:   r;   ÚscoreÚdescrr[   rX   s   f&&          @@r   ÚexplainÚMaxentClassifier.explain¢   s%  ú€ ð ˆØœC ¨a¥Ó0Õ0°:Õ=ˆà×"Ñ" :Ó.ˆÜ˜Ÿ™›¨U¯Z©ZÀÔFˆØ˜˜Ð!ˆÜØ×Ñ˜kÓ*Ø�g‰gÑ?¹Ó?Ó?õ@ô	
ô 	ˆd�S˜K¨!�O¨a´#°f³+­oÕ=Õ>Õ>Ô?Üœ3ÓˆÜ! &×)‰HˆAØ!Ÿ^™^×2Ñ2°:ÓEˆNØ×ÑÜ>Èð  ô ó  .‘�Ø×$×$Ð$Ø ŸM™M¨$Õ/°%Õ7‘Eà ŸM™M¨$Õ/°5Õ8�EØŸ™×/Ñ/°Ó5�ØŸ™Ð$4Ó5°aÕ8�Ø˜ 5�Õ(�Ü�u“: ”?Ø! #�J¨Õ.�EÜ�h¨¨Q­°­°eÐ!<Õ<Ô=Ø�U—˜uÕ$•ô  .ñ *ô" 	ˆd�S˜K¨!�O¨a´#°f³+­oÕ=Õ>Õ>Ô?ÜØ×Ñ˜[Ó)¨B¯G©GÔ3VÉvÓ3VÓ,VÕVô	
ô 	Ø×Ñ˜[Ó)Ø�g‰gÔ>±vÓ>Ó>õ?ö	
r   c           	     óÜ   a € \        S R4      '       d   S P                  RV # \        \        \	        \        S P                  4      4      4      V 3R lRR7      S n        S P                  RV # )zG
Generates the ranked list of informative features from most to least.
Ú_most_informative_featuresNc                 ó<   <€ \        SP                  V ,          4      # r!   rN   )Úfidr   s   &€r   rQ   Ú<MaxentClassifier.most_informative_features.<locals>.<lambda>×   s   ø€ ¤ D§M¡M°#Õ$6Ô 7r   Tr?   )Úhasattrrp   r]   ÚlistÚranger   r   )r   Úns   f&r   Úmost_informative_featuresÚ*MaxentClassifier.most_informative_featuresÎ   sd   ø€ ô �4Ð5×6Ò6Ø×2Ñ2°2°AÐ6Ð6ä.4Ü”Uœ3˜tŸ}™}Ó-Ó.Ó/Ü7Øô/ˆDÔ+ð
 ×2Ñ2°2°AÐ6Ð6r   c                ó�  € V P                  R4      pVR8X  d,   V Uu. uF  q@P                  V,          ^ 8”  g   K  VNK   	  ppM1VR8X  d+   V Uu. uF  q@P                  V,          ^ 8  g   K  VNK   	  ppVRV  F>  p\        V P                  V,          R RV P                  P	                  V4       24       K@  	  R# u upi u upi )zƒ
:param show: all, neg, or pos (for negative-only or positive-only)
:type show: str
:param n: The no. of top features
:type n: int
NÚposÚnegz8.3frU   )rx   r   r_   r   re   )r   rw   ÚshowÚfidsrr   s   &&&  r   Úshow_most_informative_featuresÚ/MaxentClassifier.show_most_informative_featuresÜ   s´   € ð ×-Ñ-¨dÓ3ˆØ�5Œ=Ù#'ÓB¡4˜C¯=©=¸Õ+=ÀÑ+A—C�C¡4ˆDÐBˆDØ�UŒ]Ù#'ÓB¡4˜C¯=©=¸Õ+=ÀÑ+A—C�C¡4ˆDÐBØ˜˜“8ˆCÜ�T—]‘] 3Õ'¨Ð-¨Q¨t¯~©~×/FÑ/FÀsÓ/KÐ.LÐMÖNó ùò CùâBs   �B>»B>ÁCÁ-Cc                óŠ   € R \        V P                  P                  4       4      V P                  P                  4       3,          # )z:<ConditionalExponentialClassifier: %d labels, %d features>)r   r   r"   r   r#   s   &r   Ú__repr__ÚMaxentClassifier.__repr__ì   s:   € ØKÜ�—‘×%Ñ%Ó'Ó(Ø�N‰N×!Ñ!Ó#ðO
õ 
ð 	
r   Nc                óp  € Vf   RpV F  pVR9  g   K  \        RV,          4      h	  VP                  4       pVR8X  d   \        WWE3/ VB # VR8X  d   \        WWE3/ VB # VR8X  d   \	        WWEV3/ VB # VR8X  d*   Tp	W9R&   WIR&   WYR&   WiR	&   \
        P                  ! V3/ V	B # \        R
V,          4      h)aV  
Train a new maxent classifier based on the given corpus of
training samples.  This classifier will have its weights
chosen to maximize entropy while remaining empirically
consistent with the training corpus.

:rtype: MaxentClassifier
:return: The new maxent classifier

:type train_toks: list
:param train_toks: Training data, represented as a list of
    pairs, the first member of which is a featureset,
    and the second of which is a classification label.

:type algorithm: str
:param algorithm: A case-insensitive string, specifying which
    algorithm should be used to train the classifier.  The
    following algorithms are currently available.

    - Iterative Scaling Methods: Generalized Iterative Scaling (``'GIS'``),
      Improved Iterative Scaling (``'IIS'``)
    - External Libraries (requiring megam):
      LM-BFGS algorithm, with training performed by Megam (``'megam'``)

    The default algorithm is ``'IIS'``.

:type trace: int
:param trace: The level of diagnostic tracing output to produce.
    Higher values produce more verbose output.
:type encoding: MaxentFeatureEncodingI
:param encoding: A feature encoding, used to convert featuresets
    into feature vectors.  If none is specified, then a
    ``BinaryMaxentFeatureEncoding`` will be built based on the
    features that are attested in the training corpus.
:type labels: list(str)
:param labels: The set of possible labels.  If none is given, then
    the set of all labels attested in the training data will be
    used instead.
:param gaussian_prior_sigma: The sigma value for a gaussian
    prior on model weights.  Currently, this is supported by
    ``megam``. For other algorithms, its value is ignored.
:param cutoffs: Arguments specifying various conditions under
    which the training should be halted.  (Some of the cutoff
    conditions are not supported by some algorithms.)

    - ``max_iter=v``: Terminate after ``v`` iterations.
    - ``min_ll=v``: Terminate after the negative average
      log-likelihood drops under ``v``.
    - ``min_lldelta=v``: Terminate if a single iteration improves
      log likelihood by less than ``v``.
ÚiiszUnexpected keyword arg %rÚgisÚmegamÚtadmÚtracer   r"   Úgaussian_prior_sigmazUnknown algorithm %s)	Úmax_iterÚmin_llÚmin_lldeltaÚmax_accÚmin_accdeltaÚcount_cutoffÚnormÚexplicitÚ	bernoulli)Ú	TypeErrorÚlowerÚ train_maxent_classifier_with_iisÚ train_maxent_classifier_with_gisÚ"train_maxent_classifier_with_megamÚTadmMaxentClassifierÚtrainÚ
ValueError)
ÚclsÚ
train_toksÚ	algorithmr‰   r   r"   rŠ   Úcutoffsr@   Úkwargss
   &&&&&&&,  r   rš   ÚMaxentClassifier.trainö   s  € ð| ÒØˆIÛˆCØð 
ö 
ô  Ð ;¸cÕ AÓBÐBñ ð —O‘OÓ%ˆ	Ø˜ÔÜ3Ø 8ñØ7>ñð ð ˜%ÔÜ3Ø 8ñØ7>ñð ð ˜'Ô!Ü5Ø 8Ð5IñØMTñð ð ˜&Ô ØˆFØ#�7‰OØ!)�:ÑØ%�8ÑØ-AÐ)Ñ*Ü'×-Ò-¨jÑC¸FÑCÐCäÐ3°iÕ?Ó@Ð@r   )r   r   rp   r   )T)é   )é
   )r£   Úall)ÚGISÚIISÚMEGAMÚTADM)Né   NNrM   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r"   r'   r   r/   r,   rm   rx   r   r‚   Ú
ALGORITHMSÚclassmethodrš   Ú__static_attributes__Ú__classdictcell__©Ú__classdict__s   @r   r   r   N   s\   ø‡ € ñô$1ò.'ò;òò4òTô(*
ôX7ôOò 
ò 1€JàóaAó öaAr   r   c                   óB   a € ] tR tRt o RtR tR tR tR tR t	Rt
V tR	# )
ÚMaxentFeatureEncodingIid  ap  
A mapping that converts a set of input-feature values to a vector
of joint-feature values, given a label.  This conversion is
necessary to translate featuresets into a format that can be used
by maximum entropy models.

The set of joint-features used by a given encoding is fixed, and
each index in the generated joint-feature vectors corresponds to a
single joint-feature.  The length of the generated joint-feature
vectors is therefore constant (for a given encoding).

Because the joint-feature vectors generated by
``MaxentFeatureEncodingI`` are typically very sparse, they are
represented as a list of ``(index, value)`` tuples, specifying the
value of each non-zero joint-feature.

Feature encodings are generally created using the ``train()``
method, which generates an appropriate encoding based on the
input-feature values and labels that are present in a given
corpus.
c                ó   € \        4       h)a  
Given a (featureset, label) pair, return the corresponding
vector of joint-feature values.  This vector is represented as
a list of ``(index, value)`` tuples, specifying the value of
each non-zero joint-feature.

:type featureset: dict
:rtype: list(tuple(int, int))
©ÚNotImplementedError©r   r.   r7   s   &&&r   r5   ÚMaxentFeatureEncodingI.encode{  ó   € ô "Ó#Ð#r   c                ó   € \        4       h)zr
:return: The size of the fixed-length joint-feature vectors
    that are generated by this encoding.
:rtype: int
r¸   r#   s   &r   r   ÚMaxentFeatureEncodingI.length‡  ó   € ô "Ó#Ð#r   c                ó   € \        4       h)z¶
:return: A list of the "known labels" -- i.e., all labels
    ``l`` such that ``self.encode(fs,l)`` can be a nonzero
    joint-feature vector for some value of ``fs``.
:rtype: list
r¸   r#   s   &r   r"   ÚMaxentFeatureEncodingI.labels�  s   € ô "Ó#Ð#r   c                ó   € \        4       h)z†
:return: A string describing the value of the joint-feature
    whose index in the generated feature vectors is ``fid``.
:rtype: str
r¸   ©r   rr   s   &&r   re   ÚMaxentFeatureEncodingI.describe˜  r¿   r   c                ó   € \        4       h)a7  
Construct and return new feature encoding, based on a given
training corpus ``train_toks``.

:type train_toks: list(tuple(dict, str))
:param train_toks: Training data, represented as a list of
    pairs, the first member of which is a feature dictionary,
    and the second of which is a classification label.
r¸   )rœ   r�   s   &&r   rš   ÚMaxentFeatureEncodingI.train   r¼   r   rF   N)rª   r«   r¬   r­   r®   r5   r   r"   re   rš   r±   r²   r³   s   @r   r¶   r¶   d  s(   ø‡ € ñò,
$ò$ò$ò$÷
$ð 
$r   r¶   c                   óB   a € ] tR tRt o RtR tR tR tR tR t	Rt
V tR	# )
Ú#FunctionBackedMaxentFeatureEncodingi­  z
A feature encoding that calls a user-supplied function to map a
given featureset/label pair to a sparse joint-feature vector.
c                ó*   € W n         Wn        W0n        R# )aß  
Construct a new feature encoding based on the given function.

:type func: (callable)
:param func: A function that takes two arguments, a featureset
     and a label, and returns the sparse joint feature vector
     that encodes them::

         func(featureset, label) -> feature_vector

     This sparse joint feature vector (``feature_vector``) is a
     list of ``(index,value)`` tuples.

:type length: int
:param length: The size of the fixed-length joint-feature
    vectors that are generated by this encoding.

:type labels: list
:param labels: A list of the "known labels" for this
    encoding -- i.e., all labels ``l`` such that
    ``self.encode(fs,l)`` can be a nonzero joint-feature vector
    for some value of ``fs``.
N)Ú_lengthÚ_funcÚ_labels)r   Úfuncr   r"   s   &&&&r   r   Ú,FunctionBackedMaxentFeatureEncoding.__init__³  s   € ð0 ŒØŒ
ØŽr   c                ó$   € V P                  W4      # r!   )rË   rº   s   &&&r   r5   Ú*FunctionBackedMaxentFeatureEncoding.encodeÏ  s   € Ø�z‰z˜*Ó,Ð,r   c                ó   € V P                   # r!   ©rÊ   r#   s   &r   r   Ú*FunctionBackedMaxentFeatureEncoding.lengthÒ  ó   € Ø�|‰|Ðr   c                ó   € V P                   # r!   ©rÌ   r#   s   &r   r"   Ú*FunctionBackedMaxentFeatureEncoding.labelsÕ  rÔ   r   c                ó   € R # )zno description availablerF   rÃ   s   &&r   re   Ú,FunctionBackedMaxentFeatureEncoding.describeØ  s   € Ù)r   )rË   rÌ   rÊ   N)rª   r«   r¬   r­   r®   r   r5   r   r"   re   r±   r²   r³   s   @r   rÈ   rÈ   ­  s(   ø‡ € ñò
ò8-òò÷*ð *r   rÈ   c                   óZ   a € ] tR tRt o RtRR ltR tR tR tR t	]
RR	 l4       tR
tV tR# )ÚBinaryMaxentFeatureEncodingiÜ  a„  
A feature encoding that generates vectors containing a binary
joint-features of the form:

|  joint_feat(fs, l) = { 1 if (fs[fname] == fval) and (l == label)
|                      {
|                      { 0 otherwise

Where ``fname`` is the name of an input-feature, ``fval`` is a value
for that input-feature, and ``label`` is a label.

Typically, these features are constructed based on a training
corpus, using the ``train()`` method.  This method will create one
feature for each combination of ``fname``, ``fval``, and ``label``
that occurs at least once in the training corpus.

The ``unseen_features`` parameter can be used to add "unseen-value
features", which are used whenever an input feature has a value
that was not encountered in the training corpus.  These features
have the form:

|  joint_feat(fs, l) = { 1 if is_unseen(fname, fs[fname])
|                      {      and l == label
|                      {
|                      { 0 otherwise

Where ``is_unseen(fname, fval)`` is true if the encoding does not
contain any joint features that are true when ``fs[fname]==fval``.

The ``alwayson_features`` parameter can be used to add "always-on
features", which have the form::

|  joint_feat(fs, l) = { 1 if (l == label)
|                      {
|                      { 0 otherwise

These always-on features allow the maxent model to directly model
the prior probabilities of each label.
c                óè  € \        VP                  4       4      \        \        \        V4      4      4      8w  d   \	        R4      h\        V4      V n         W n         \        V4      V n         RV n	         RV n
         V'       db   \        V4       UUu/ uF  w  rVWeV P                  ,           bK  	  uppV n	        V ;P                  \        V P                  4      ,          un        V'       dq   V UUUu0 uF  w  rxqgkK	  	  p	ppp\        V	4       UUu/ uF  w  rWWuV P                  ,           bK  	  uppV n
        V ;P                  \        V	4      ,          un        R# R# u uppi u upppi u uppi )a[  
:param labels: A list of the "known labels" for this encoding.

:param mapping: A dictionary mapping from ``(fname,fval,label)``
    tuples to corresponding joint-feature indexes.  These
    indexes must be the set of integers from 0...len(mapping).
    If ``mapping[fname,fval,label]=id``, then
    ``self.encode(..., fname:fval, ..., label)[id]`` is 1;
    otherwise, it is 0.

:param unseen_features: If true, then include unseen value
   features in the generated joint-feature vectors.

:param alwayson_features: If true, then include always-on
   features in the generated joint-feature vectors.
úHMapping values must be exactly the set of integers from 0...len(mapping)N©ÚsetÚvaluesrv   r   r›   ru   rÌ   Ú_mappingrÊ   Ú	_alwaysonÚ_unseenrc   ©
r   r"   ÚmappingÚunseen_featuresÚalwayson_featuresrj   r7   ÚfnameÚfvalÚfnamess
   &&&&&     r   r   Ú$BinaryMaxentFeatureEncoding.__init__  ó*  € ô" ˆw�~‰~ÓÓ ¤C¬¬c°'«lÓ(;Ó$<Ô<Üð8óð ô
 ˜F“|ˆŒØ(àŒØ9ä˜7“|ˆŒØ<àˆŒØ,àˆŒØ,çä:CÀFÔ:KôÙ:K©J¨Q�˜4Ÿ<™<Õ'Ò'Ñ:KòˆDŒNð �LŠLœC §¡Ó/Õ/�LçÙ8?Õ@¹Ñ 4 ¨e’e¹ˆFÒ@ÜFOÐPVÔFWÔXÑFW¹
¸˜E t§|¡|Õ#3Ò3ÑFWÒXˆDŒLØ�LŠLœC ›KÕ'�Lñ ùóùô AùÛXó   ÂE!Ã5E'ÄE.c                ó$  € . pVP                  4        F³  w  rEWEV3V P                  9   d)   VP                  V P                  WEV3,          ^34       K@  V P                  '       g   KT  V P                   F  pWEV3V P                  9   g   K   K{  	  W@P                  9   g   K�  VP                  V P                  V,          ^34       Kµ  	  V P
                  '       d5   W P
                  9   d%   VP                  V P
                  V,          ^34       V# ©é   )Úitemsrá   Úappendrã   rÌ   râ   ©r   r.   r7   r   rè   ré   Úlabel2s   &&&    r   r5   Ú"BinaryMaxentFeatureEncoding.encode6  sÔ   € àˆð &×+Ñ+Ö-‰KˆEà˜UÐ# t§}¡}Ô4Ø—‘ §¡¨u¸EÐ/AÕ!BÀAÐ FÖGð ——’à"Ÿlœl�FØ VÐ,°·±Ö=Úñ +ð
 §¡Ö,Ø Ÿ™¨¯©°eÕ)<¸aÐ(@ÖAñ .ð" �>�>ˆ>˜e§~¡~Ô5Ø�O‰O˜TŸ^™^¨EÕ2°AÐ6Ô7àˆr   c                óN  € \        V\        4      '       g   \        R 4      h V P                   V\        V P                  4      8  d#   V P                  V,          w  rEpV RV: RV: 2# V P                  '       dU   WP                  P                  4       9   d7   V P                  P                  4        F  w  rgW8X  g   K  RV,          u # 	  R# V P                  '       dU   WP                  P                  4       9   d7   V P                  P                  4        F  w  rGW8X  g   K  RV,          u # 	  R# \        R4      h  \         dX    R.\        T P                  4      ,          T n        T P                  P                  4        F  w  r#Y P                  T&   K  	   ELti ; i©zdescribe() expected an intz==rS   zlabel is %rz%s is unseenzBad feature idNéÿÿÿÿ©Ú
isinstancerb   r”   Ú_inv_mappingÚAttributeErrorr   rá   rñ   râ   rà   rã   r›   ©r   r:   Úinforj   rè   ré   r7   Úf_id2s   &&      r   re   Ú$BinaryMaxentFeatureEncoding.describeQ  óP  € ä˜$¤×$Ò$ÜÐ8Ó9Ð9ð	,Ø×Òð ”#�d—m‘mÓ$Ô$Ø#'×#4Ñ#4°TÕ#:Ñ ˆU˜%Ø�W˜B˜t™h n°U±IÐ>Ð>Ø�^�^ˆ^ ¯©×(=Ñ(=Ó(?Ô ?Ø $§¡× 4Ñ 4Ö 6‘�Ø–=Ø(¨5Õ0Ò0ó !7ð �\�\ˆ\˜d§l¡l×&9Ñ&9Ó&;Ô;Ø $§¡× 2Ñ 2Ö 4‘�Ø–=Ø)¨EÕ1Ò1ó !5ô Ð-Ó.Ð.øô# ô 	,Ø!# ¤s¨4¯=©=Ó'9Õ 9ˆDÔØŸ=™=×.Ñ.Ö0‘�Ø'+×!Ñ! !Ó$ô 1ð	,úó   £E ÅAF$Æ#F$c                ó   € V P                   # r!   rÖ   r#   s   &r   r"   Ú"BinaryMaxentFeatureEncoding.labelsj  ó   € à�|‰|Ðr   c                ó   € V P                   # r!   rÒ   r#   s   &r   r   Ú"BinaryMaxentFeatureEncoding.lengthn  r  r   Nc                ó‚  € / p\        4       p\        \        4      pV F�  w  r‰V'       d   W“9  d   \        RV	,          4      hVP	                  V	4       VP                  4        FF  w  r«WzV3;;,          ^,          uu&   WzV3,          V8¼  g   K,  W«V	3V9  g   K7  \        V4      WZW¹3&   KH  	  K’  	  Vf   TpV ! W53/ VB # )a  
Construct and return new feature encoding, based on a given
training corpus ``train_toks``.  See the class description
``BinaryMaxentFeatureEncoding`` for a description of the
joint-features that will be included in this encoding.

:type train_toks: list(tuple(dict, str))
:param train_toks: Training data, represented as a list of
    pairs, the first member of which is a feature dictionary,
    and the second of which is a classification label.

:type count_cutoff: int
:param count_cutoff: A cutoff value that is used to discard
    rare joint-features.  If a joint-feature's value is 1
    fewer than ``count_cutoff`` times in the training corpus,
    then that joint-feature is not included in the generated
    encoding.

:type labels: list
:param labels: A list of labels that should be used by the
    classifier.  If not specified, then the set of labels
    attested in ``train_toks`` will be used.

:param options: Extra parameters for the constructor, such as
    ``unseen_features`` and ``alwayson_features``.
úUnexpected label %s)rß   r   rb   r›   Úaddrñ   r   ©rœ   r�   r�   r"   Úoptionsrå   Úseen_labelsÚcountÚtokr7   rè   ré   s   &&&&,       r   rš   Ú!BinaryMaxentFeatureEncoding.trainr  s¼   € ð8 ˆÜ“eˆÜœCÓ ˆã$‰JˆCß˜%Ô-Ü Ð!6¸Õ!>Ó?Ð?Ø�O‰O˜EÔ"ð  #Ÿy™yž{‘�ð ˜T�k×" aÕ'Ó"Ø ˜Õ%¨Ö5Ø UÐ+°7Ö:Ü69¸'³l˜ tÐ 2Ó3ó  +ñ %ð Š>Ø ˆFÙ�6Ñ. gÑ.Ð.r   ©râ   rû   rÌ   rÊ   rá   rã   ©FF©rM   N©rª   r«   r¬   r­   r®   r   r5   re   r"   r   r°   rš   r±   r²   r³   s   @r   rÛ   rÛ   Ü  s9   ø‡ € ñ&ôP/(òbò6/ò2òð ó0/ó ö0/r   rÛ   c                   óP   a € ] tR tRt o RtR
R lt]R 4       tR tR t	R t
R	tV tR# )ÚGISEncodingi¦  aó  
A binary feature encoding which adds one new joint-feature to the
joint-features defined by ``BinaryMaxentFeatureEncoding``: a
correction feature, whose value is chosen to ensure that the
sparse vector always sums to a constant non-negative number.  This
new feature is used to ensure two preconditions for the GIS
training algorithm:

  - At least one feature vector index must be nonzero for every
    token.
  - The feature vector must sum to a constant non-negative number
    for every token.
Nc           
     ó¦   € \         P                  WW#V4       Vf)   \        V UUUu0 uF  w  rgq†kK	  	  uppp4      ^,           pWPn        R# u upppi )zá
:param C: The correction constant.  The value of the correction
    feature is based on this value.  In particular, its value is
    ``C - sum([v for (f,v) in encoding])``.
:seealso: ``BinaryMaxentFeatureEncoding.__init__``
N)rÛ   r   r   Ú_C)	r   r"   rå   ræ   rç   ÚCrè   ré   r7   s	   &&&&&&   r   r   ÚGISEncoding.__init__µ  sO   € ô 	$×,Ñ,Ø˜'Ð4Eô	
ð Š9Ü±wÕ?±wÑ3 ¨U’U±wÓ?Ó@À1ÕDˆAØŽùô @s   §Ac                ó   € V P                   # )zGThe non-negative constant that all encoded feature vectors
will sum to.©r  r#   s   &r   r  ÚGISEncoding.CÅ  s   € ð �w‰wˆr   c                óü   € \         P                  WV4      p\         P                  V 4      p\        R  V 4       4      pWPP                  8¼  d   \        R4      hVP                  W@P                  V,
          34       V# )c              3   ó*   "  € T F	  w  rVx € K  	  R # 5ir!   rF   )rG   ÚfÚvs   &  r   rI   Ú%GISEncoding.encode.<locals>.<genexpr>Ñ  s   é € Ð-¡H™&˜1•A£Hùó   ‚z&Correction feature is not high enough!)rÛ   r5   r   Úsumr  r›   rò   )r   r.   r7   r   Úbase_lengthr9   s   &&&   r   r5   ÚGISEncoding.encodeË  sj   € ä.×5Ñ5°dÈÓNˆÜ1×8Ñ8¸Ó>ˆô Ñ-¡HÓ-Ó-ˆØ—G‘GÔÜÐEÓFÐFØ�‰˜§g¡g°¥oÐ6Ô7ð ˆr   c                ó:   € \         P                  V 4      ^,           # rï   )rÛ   r   r#   s   &r   r   ÚGISEncoding.lengthÙ  s   € Ü*×1Ñ1°$Ó7¸!Õ;Ð;r   c                ó†   € V\         P                  V 4      8X  d   R V P                  ,          # \         P                  W4      # )zCorrection feature (%s))rÛ   r   r  re   )r   r:   s   &&r   re   ÚGISEncoding.describeÜ  s6   € ØÔ.×5Ñ5°dÓ;Ô;Ø,¨t¯w©wÕ6Ð6ä.×7Ñ7¸ÓCÐCr   r  )FFN)rª   r«   r¬   r­   r®   r   Úpropertyr  r5   r   re   r±   r²   r³   s   @r   r  r  ¦  s9   ø‡ € ñôð  ñó ðò
ò<÷Dð Dr   r  c                   óV   a € ] tR tRt o R
R ltR tR tR tR t]	RR l4       t
R	tV tR# )ÚTadmEventMaxentFeatureEncodingiã  c                ó†   € \        V4      V n        \        4       V n        \        P	                  WV P                  W44       R # r!   )r   rá   Ú_label_mappingrÛ   r   )r   r"   rå   ræ   rç   s   &&&&&r   r   Ú'TadmEventMaxentFeatureEncoding.__init__ä  s1   € Ü# GÓ,ˆŒÜ)›mˆÔÜ#×,Ñ,Ø˜$Ÿ-™-¨ö	
r   c                óÀ  € . pVP                  4        FÇ  w  rEWB3V P                  9  d$   \        V P                  4      V P                  WB3&   WPP                  9  dH   \	        V\
        4      '       g$   \        V P                  4      V P                  V&   MWPP                  V&   VP                  V P                  WB3,          V P                  V,          34       KÉ  	  V# r!   )rñ   rá   r   r/  rú   rb   rò   )r   r.   r7   r   ÚfeatureÚvalues   &&&   r   r5   Ú%TadmEventMaxentFeatureEncoding.encodeë  s¹   € ØˆØ(×.Ñ.Ö0‰NˆGØÐ t§}¡}Ô4Ü25°d·m±mÓ2D�—‘˜wÐ.Ñ/Ø×/Ñ/Ô/Ü! %¬×-Ò-Ü14°T×5HÑ5HÓ1I�D×'Ñ'¨Ò.à16×'Ñ'¨Ñ.Ø�O‰OØ—‘ Ð/Õ0°$×2EÑ2EÀeÕ2LÐMöñ 1ð ˆr   c                ó   € V P                   # r!   rÖ   r#   s   &r   r"   Ú%TadmEventMaxentFeatureEncoding.labelsú  rÔ   r   c                ól   € V P                    F#  w  r#V P                   W#3,          V8X  g   K   W#3u # 	  R # r!   )rá   )r   rr   r2  r7   s   &&  r   re   Ú'TadmEventMaxentFeatureEncoding.describeý  s/   € Ø"Ÿmœm‰NˆGØ�}‰}˜gÐ-Õ.°#Ö5ØÐ'Ò'ó ,r   c                ó,   € \        V P                  4      # r!   )r   rá   r#   s   &r   r   Ú%TadmEventMaxentFeatureEncoding.length  s   € Ü�4—=‘=Ó!Ð!r   Nc                ó  € \        4       pV'       g   . p\        V4      pV F  w  rgWs9  g   K  VP                  V4       K   	  V F0  w  rgV F%  pV F  pW‡3V9  g   K  \        V4      WXV3&   K  	  K'  	  K2  	  V ! W53/ VB # r!   )r   ru   rò   r   )	rœ   r�   r�   r"   r  rå   r.   r7   r2  s	   &&&&,    r   rš   Ú$TadmEventMaxentFeatureEncoding.train  s�   € ä“-ˆßØˆFô ˜*Ó%ˆ
ã!+ÑˆJØÖ"Ø—‘˜eÖ$ñ ",ó ",ÑˆJÛ�Û)�GØÐ'¨wÖ6Ü47¸³L˜¨%Ð 0Ó1ó  *ó  ñ ",ñ �6Ñ. gÑ.Ð.r   )r/  rá   r  r  )rª   r«   r¬   r­   r   r5   r"   re   r   r°   rš   r±   r²   r³   s   @r   r-  r-  ã  s2   ø‡ € ô
òòò(ò
"ð ó/ó ö/r   r-  c                   óZ   a € ] tR tRt o RtRR ltR tR tR tR t	]
RR	 l4       tR
tV tR# )ÚTypedMaxentFeatureEncodingi  aº  
A feature encoding that generates vectors containing integer,
float and binary joint-features of the form:

Binary (for string and boolean features):

|  joint_feat(fs, l) = { 1 if (fs[fname] == fval) and (l == label)
|                      {
|                      { 0 otherwise

Value (for integer and float features):

|  joint_feat(fs, l) = { fval if     (fs[fname] == type(fval))
|                      {         and (l == label)
|                      {
|                      { not encoded otherwise

Where ``fname`` is the name of an input-feature, ``fval`` is a value
for that input-feature, and ``label`` is a label.

Typically, these features are constructed based on a training
corpus, using the ``train()`` method.

For string and boolean features [type(fval) not in (int, float)]
this method will create one feature for each combination of
``fname``, ``fval``, and ``label`` that occurs at least once in the
training corpus.

For integer and float features [type(fval) in (int, float)] this
method will create one feature for each combination of ``fname``
and ``label`` that occurs at least once in the training corpus.

For binary features the ``unseen_features`` parameter can be used
to add "unseen-value features", which are used whenever an input
feature has a value that was not encountered in the training
corpus.  These features have the form:

|  joint_feat(fs, l) = { 1 if is_unseen(fname, fs[fname])
|                      {      and l == label
|                      {
|                      { 0 otherwise

Where ``is_unseen(fname, fval)`` is true if the encoding does not
contain any joint features that are true when ``fs[fname]==fval``.

The ``alwayson_features`` parameter can be used to add "always-on
features", which have the form:

|  joint_feat(fs, l) = { 1 if (l == label)
|                      {
|                      { 0 otherwise

These always-on features allow the maxent model to directly model
the prior probabilities of each label.
c                óè  € \        VP                  4       4      \        \        \        V4      4      4      8w  d   \	        R4      h\        V4      V n         W n         \        V4      V n         RV n	         RV n
         V'       db   \        V4       UUu/ uF  w  rVWeV P                  ,           bK  	  uppV n	        V ;P                  \        V P                  4      ,          un        V'       dq   V UUUu0 uF  w  rxqgkK	  	  p	ppp\        V	4       UUu/ uF  w  rWWuV P                  ,           bK  	  uppV n
        V ;P                  \        V	4      ,          un        R# R# u uppi u upppi u uppi )a]  
:param labels: A list of the "known labels" for this encoding.

:param mapping: A dictionary mapping from ``(fname,fval,label)``
    tuples to corresponding joint-feature indexes.  These
    indexes must be the set of integers from 0...len(mapping).
    If ``mapping[fname,fval,label]=id``, then
    ``self.encode({..., fname:fval, ...``, label)[id]} is 1;
    otherwise, it is 0.

:param unseen_features: If true, then include unseen value
   features in the generated joint-feature vectors.

:param alwayson_features: If true, then include always-on
   features in the generated joint-feature vectors.
rÝ   NrÞ   rä   s
   &&&&&     r   r   Ú#TypedMaxentFeatureEncoding.__init__T  rì   rí   c                ó  € . pVP                  4        EF!  w  rE\        V\        \        34      '       dR   V\	        V4      V3V P
                  9   d3   VP                  V P
                  V\	        V4      V3,          V34       Kq  Ks  WEV3V P
                  9   d)   VP                  V P
                  WEV3,          ^34       K®  V P                  '       g   KÂ  V P                   F  pWEV3V P
                  9   g   K   Ké  	  W@P                  9   g   Ký  VP                  V P                  V,          ^34       EK$  	  V P                  '       d5   W P                  9   d%   VP                  V P                  V,          ^34       V# rï   )
rñ   rú   rb   ÚfloatÚtyperá   rò   rã   rÌ   râ   ró   s   &&&    r   r5   Ú!TypedMaxentFeatureEncoding.encode…  s(  € àˆð &×+Ñ+×-‰KˆEÜ˜$¤¤e ×-Ò-àœ4 ›: uÐ-°·±Ô>Ø—O‘O T§]¡]°5¼$¸t»*ÀeÐ3KÕ%LÈdÐ$SÖTñ ?ð  Ð'¨4¯=©=Ô8Ø—O‘O T§]¡]°5ÀÐ3EÕ%FÈÐ$JÖKð —\—\’\à"&§,¤,˜Ø!¨Ð0°D·M±MÖAÚ!ñ #/ð
 !§L¡LÖ0Ø$ŸO™O¨T¯\©\¸%Õ-@À!Ð,D×Eñ' .ð, �>�>ˆ>˜e§~¡~Ô5Ø�O‰O˜TŸ^™^¨EÕ2°AÐ6Ô7àˆr   c                óN  € \        V\        4      '       g   \        R 4      h V P                   V\        V P                  4      8  d#   V P                  V,          w  rEpV RV: RV: 2# V P                  '       dU   WP                  P                  4       9   d7   V P                  P                  4        F  w  rgW8X  g   K  RV,          u # 	  R# V P                  '       dU   WP                  P                  4       9   d7   V P                  P                  4        F  w  rGW8X  g   K  RV,          u # 	  R# \        R4      h  \         dX    R.\        T P                  4      ,          T n        T P                  P                  4        F  w  r#Y P                  T&   K  	   ELti ; ir÷   rù   rý   s   &&      r   re   Ú#TypedMaxentFeatureEncoding.describe¥  r  r  c                ó   € V P                   # r!   rÖ   r#   s   &r   r"   Ú!TypedMaxentFeatureEncoding.labels¾  r  r   c                ó   € V P                   # r!   rÒ   r#   s   &r   r   Ú!TypedMaxentFeatureEncoding.lengthÂ  r  r   Nc                óÌ  € / p\        4       p\        \        4      pV Fµ  w  r‰V'       d   W“9  d   \        RV	,          4      hVP	                  V	4       VP                  4        Fk  w  r«\        V4      \        \        39   d   \        V4      pWzV3;;,          ^,          uu&   WzV3,          V8¼  g   KQ  W«V	3V9  g   K\  \        V4      WZW¹3&   Km  	  K·  	  Vf   TpV ! W53/ VB # )aq  
Construct and return new feature encoding, based on a given
training corpus ``train_toks``.  See the class description
``TypedMaxentFeatureEncoding`` for a description of the
joint-features that will be included in this encoding.

Note: recognized feature values types are (int, float), over
types are interpreted as regular binary features.

:type train_toks: list(tuple(dict, str))
:param train_toks: Training data, represented as a list of
    pairs, the first member of which is a feature dictionary,
    and the second of which is a classification label.

:type count_cutoff: int
:param count_cutoff: A cutoff value that is used to discard
    rare joint-features.  If a joint-feature's value is 1
    fewer than ``count_cutoff`` times in the training corpus,
    then that joint-feature is not included in the generated
    encoding.

:type labels: list
:param labels: A list of labels that should be used by the
    classifier.  If not specified, then the set of labels
    attested in ``train_toks`` will be used.

:param options: Extra parameters for the constructor, such as
    ``unseen_features`` and ``alwayson_features``.
r	  )	rß   r   rb   r›   r
  rñ   rC  rB  r   r  s   &&&&,       r   rš   Ú TypedMaxentFeatureEncoding.trainÆ  sÕ   € ð> ˆÜ“eˆÜœCÓ ˆã$‰JˆCß˜%Ô-Ü Ð!6¸Õ!>Ó?Ð?Ø�O‰O˜EÔ"ð  #Ÿy™yž{‘�Ü˜“:¤#¤u Ô-Ü ›:�Dð ˜T�k×" aÕ'Ó"Ø ˜Õ%¨Ö5Ø UÐ+°7Ö:Ü69¸'³l˜ tÐ 2Ó3ó  +ñ %ð" Š>Ø ˆFÙ�6Ñ. gÑ.Ð.r   r  r  r  r  r³   s   @r   r>  r>    s:   ø‡ € ñ6ôp/(òbò@/ò2òð ó5/ó ö5/r   r>  c                ó  € VP                  R^d4       \        V4      pVf   \        P                  WR7      p\	        VR4      '       g   \        R4      hRVP                  ,          p\        W4      p\        \        P                  ! V^ 8H  4      ^ ,          4      p\        P                  ! \        V4      R4      p	V F  p
\        P                  Wš&   K  	  \        W)4      p\        P                  ! V4      p?V^ 8”  d   \!        RVR,          ,          4       V^8”  d!   \!        4        \!        R4       \!        R	4         V^8”  d_   VP"                  ;'       g    \%        W°4      pVP&                  ;'       g    \)        W°4      pVP*                  p\!        R
WýV3,          4       \-        W°V4      pV F  p
VV
;;,          ^,          uu&   K  	  \        P                  ! V4      p?VP/                  4       p	WœV,
          V,          ,          p	VP1                  V	4       VP3                  W°4      '       g   K÷   T^8”  d*   \%        Y°4      p\)        Y°4      p\!        RTR RTR 24       T#   \4         d    \!        R4        LJ h ; i)aj  
Train a new ``ConditionalExponentialClassifier``, using the given
training samples, using the Generalized Iterative Scaling
algorithm.  This ``ConditionalExponentialClassifier`` will encode
the model that maximizes entropy from all the models that are
empirically consistent with ``train_toks``.

:see: ``train_maxent_classifier()`` for parameter descriptions.
r‹   ©r"   r  zJThe GIS algorithm requires an encoding that defines C (e.g., GISEncoding).r2   Údú  ==> Training (%d iterations)ú-      Iteration    Log Likelihood    Accuracyú-      ---------------------------------------ú     %9d    %14.5f    %9.3fú*      Training stopped: keyboard interruptú         Final    ú14.5fú    ú9.3f)Ú
setdefaultr
   r  rš   rt   r”   r  Úcalculate_empirical_fcountrß   ÚnumpyÚnonzeroÚzerosr   ÚNINFÚ ConditionalExponentialClassifierÚlog2r_   Úllr   Úaccr   ÚiterÚcalculate_estimated_fcountr   r'   ÚcheckÚKeyboardInterrupt)r�   r‰   r   r"   rŸ   ÚcutoffcheckerÚCinvÚempirical_fcountÚ
unattestedr   rr   Ú
classifierÚlog_empirical_fcountra  rb  ÚiternumÚestimated_fcountÚlog_estimated_fcounts   &&&&,             r   r—   r—     sZ  € ð ×Ñ�z 3Ô'Ü! 'Ó*€Mð ÒÜ×$Ñ$ ZÐ$Ó?ˆä�8˜S×!Ò!Üð-ó
ð 	
ð �—‘Õ€Dô 2°*ÓGÐô ”U—]’]Ð#3°qÑ#8Ó9¸!Õ<Ó=€Jô �kŠkœ#Ð.Ó/°Ó5€GÛˆÜ—z‘zˆ‹ñ ä1°(ÓD€Jô !Ÿ:š:Ð&6Ó7ÐØàˆq„yÜÐ.°¸Õ1DÕDÔEØˆq„yÜŒÜÐ=Ô>ÜÐ=Ô>ð ØØ�qŒyØ"×%Ñ%×OÐO¬¸
Ó)O�Ø#×'Ñ'×KÐK¬8°JÓ+K�Ø'×,Ñ,�ÜÐ3°wÀCÐ6HÕHÔIô  :Ø¨ó Ðó
 "�Ø  ×%¨Õ*Õ%ñ "ä#(§:¢:Ð.>Ó#?Ð Ø ð !×(Ñ(Ó*ˆGØÐ/CÕCÀtÕKÕKˆGØ×"Ñ" 7Ô+ð ×"Ñ" :×:Ô:Øð ˆq„yÜ˜JÓ3ˆÜ�zÓ.ˆÜÐ" 2 e *¨D°°T°
Ð;Ô<ð Ðøô ô <ÜÐ:Ö;ðØús   ÅI+ ÅI+ Å;B8I+ É+JÊJc                 óÂ   € \         P                  ! VP                  4       R 4      pV  F3  w  r4VP                  W44       F  w  rVW%;;,          V,          uu&   K  	  K5  	  V# ©rO  )r[  r]  r   r5   )r�   r   Úfcountr  r7   ÚindexÚvals   &&     r   rZ  rZ  f  sM   € Ü�[Š[˜Ÿ™Ó*¨CÓ0€Fã ‰
ˆØ"Ÿ/™/¨#Ö5‰JˆEØ�M˜SÕ �Mó 6ñ !ð €Mr   c                 ó@  € \         P                  ! VP                  4       R 4      pV Fr  w  rEV P                  V4      pVP	                  4        FH  pVP                  V4      pVP                  WE4       F  w  r‰W8;;,          Wy,          ,          uu&   K!  	  KJ  	  Kt  	  V# rq  )r[  r]  r   r,   r^   rZ   r5   )
rk  r�   r   rr  r  r7   r[   rZ   rr   ré   s
   &&&       r   rd  rd  p  s}   € Ü�[Š[˜Ÿ™Ó*¨CÓ0€Fã ‰
ˆØ×(Ñ(¨Ó-ˆØ—]‘]–_ˆEØ—:‘:˜eÓ$ˆDØ%Ÿ_™_¨SÖ8‘	�Ø—˜t�{Õ*•ó 9ó %ñ !ð €Mr   c           
     óÚ  € VP                  R^d4       \        V4      pVf   \        P                  WR7      p\	        W4      \        V 4      ,          p\        W4      p\        P                  ! \        WwP                  R7      R4      p\        P                  ! V\        V4      ^34      p	\        \        P                  ! V^ 8H  4      ^ ,          4      p
\        P                  ! \        V4      R4      pV
 F  p\        P                  W¼&   K  	  \!        W+4      pV^ 8”  d   \#        RVR,          ,          4       V^8”  d!   \#        4        \#        R4       \#        R4         V^8”  d_   VP$                  ;'       g    \'        WÐ4      pVP(                  ;'       g    \+        WÐ4      pVP,                  p\#        RVWï3,          4       \/        V VV
VVVV	V4      pVP1                  4       pVV,          pVP3                  V4       VP5                  WÐ4      '       g   K»   T^8”  d*   \'        YÐ4      p\+        YÐ4      p\#        R
TR RTR 24       T#   \6         d    \#        R	4        LJ h ; i)af  
Train a new ``ConditionalExponentialClassifier``, using the given
training samples, using the Improved Iterative Scaling algorithm.
This ``ConditionalExponentialClassifier`` will encode the model
that maximizes entropy from all the models that are empirically
consistent with ``train_toks``.

:see: ``train_maxent_classifier()`` for parameter descriptions.
r‹   rN  )r@   rO  rP  rQ  rR  rS  rT  rU  rV  rW  rX  )rY  r
   rÛ   rš   rZ  r   Úcalculate_nfmapr[  Úarrayr]   Ú__getitem__Úreshaperß   r\  r]  r^  r_  r_   ra  r   rb  r   rc  Úcalculate_deltasr   r'   re  rf  )r�   r‰   r   r"   rŸ   rg  Úempirical_ffreqÚnfmapÚnfarrayÚnftransposerj  r   rr   rk  ra  rb  rm  Údeltass   &&&&,             r   r–   r–   ‚  s6  € ð ×Ñ�z 3Ô'Ü! 'Ó*€Mð ÒÜ.×4Ñ4°ZÐ4ÓOˆô 1°ÓFÌÈZËÕX€Oô ˜JÓ1€EÜ�kŠkœ& ×,=Ñ,=Ô>ÀÓD€GÜ—-’- ¬#¨g«,¸Ð):Ó;€Kô ”U—]’] ?°aÑ#7Ó8¸Õ;Ó<€Jô �kŠkœ#˜oÓ.°Ó4€GÛˆÜ—z‘zˆ‹ñ ä1°(ÓD€Jàˆq„yÜÐ.°¸Õ1DÕDÔEØˆq„yÜŒÜÐ=Ô>ÜÐ=Ô>ð ØØ�qŒyØ"×%Ñ%×OÐO¬¸
Ó)O�Ø#×'Ñ'×KÐK¬8°JÓ+K�Ø'×,Ñ,�ÜÐ3°wÀÐ6HÕHÔIô &ØØØØØØØØó	ˆFð !×(Ñ(Ó*ˆGØ�vÕˆGØ×"Ñ" 7Ô+ð ×"Ñ" :×:Ô:Øð ˆq„yÜ˜JÓ3ˆÜ�zÓ.ˆÜÐ" 2 e *¨D°°T°
Ð;Ô<ð Ðøô ô <ÜÐ:Ö;ðØús   Å"I Å=I ÆA<I ÉI*É(I*c                ó  € \        4       pV  FL  w  r4VP                  4        F3  pVP                  \        R VP	                  W54       4       4      4       K5  	  KN  	  \        V4       UUu/ uF  w  rgWvbK	  	  upp# u uppi )a·  
Construct a map that can be used to compress ``nf`` (which is
typically sparse).

*nf(feature_vector)* is the sum of the feature values for
*feature_vector*.

This represents the number of features that are active for a
given labeled text.  This method finds all values of *nf(t)*
that are attested for at least one token in the given list of
training tokens; and constructs a dictionary mapping these
attested values to a continuous range *0...N*.  For example,
if the only values of *nf()* that were attested were 3, 5, and
7, then ``_nfmap`` might return the dictionary ``{3:0, 5:1, 7:2}``.

:return: A map that can be used to compress ``nf`` to a dense
    vector.
:rtype: dict(int -> int)
c              3   ó*   "  € T F	  w  rVx € K  	  R # 5ir!   rF   ©rG   Úidrt  s   &  r   rI   Ú"calculate_nfmap.<locals>.<genexpr>ö  s   é € ÐKÑ/J¡) 2�#Ó/Jùr#  )rß   r"   r
  r$  r5   rc   )r�   r   Únfsetr  Ú_r7   rj   Únfs   &&      r   rw  rw  Þ  sm   € ô* ‹E€EÛ‰ˆØ—_‘_Ö&ˆEØ�I‰I”cÑK¨x¯©¸sÔ/JÓKÓKÖLó 'ñ ô "+¨5Ô!1Ô2Ñ!1‘g�qˆBŠEÑ!1Ò2Ð2ùÓ2s   Á+A<c           	     ó
  € RpRp	\         P                  ! VP                  4       R4      p
\         P                  ! \	        V4      VP                  4       3R4      pV  F�  w  rÍVP                  V4      pVP                  4        Fe  pVP                  WÍ4      p\        R V 4       4      pV F9  w  ppW´V,          V3;;,          VP                  V4      V,          ,          uu&   K;  	  Kg  	  K‘  	  V\	        V 4      ,          p\        V	4       Fó  p\         P                  ! WZ4      p^V,          pVV,          p\         P                  ! VV,          ^ R7      p\         P                  ! VV,          ^ R7      pV F  pVV;;,          ^,          uu&   K  	  W£V,
          V) ,          ,          p
\         P                  ! \        VV,
          4      4      \         P                  ! \        V
4      4      ,          pVV8  g   Kñ  V
u # 	  V
# )aW	  
Calculate the update values for the classifier weights for
this iteration of IIS.  These update weights are the value of
``delta`` that solves the equation::

  ffreq_empirical[i]
         =
  SUM[fs,l] (classifier.prob_classify(fs).prob(l) *
             feature_vector(fs,l)[i] *
             exp(delta[i] * nf(feature_vector(fs,l))))

Where:
    - *(fs,l)* is a (featureset, label) tuple from ``train_toks``
    - *feature_vector(fs,l)* = ``encoding.encode(fs,l)``
    - *nf(vector)* = ``sum([val for (id,val) in vector])``

This method uses Newton's method to solve this equation for
*delta[i]*.  In particular, it starts with a guess of
``delta[i]`` = 1; and iteratively updates ``delta`` with:

| delta[i] -= (ffreq_empirical[i] - sum1[i])/(-sum2[i])

until convergence, where *sum1* and *sum2* are defined as:

|    sum1[i](delta) = SUM[fs,l] f[i](fs,l,delta)
|    sum2[i](delta) = SUM[fs,l] (f[i](fs,l,delta).nf(feature_vector(fs,l)))
|    f[i](fs,l,delta) = (classifier.prob_classify(fs).prob(l) .
|                        feature_vector(fs,l)[i] .
|                        exp(delta[i] . nf(feature_vector(fs,l))))

Note that *sum1* and *sum2* depend on ``delta``; so they need
to be re-computed each iteration.

The variables ``nfmap``, ``nfarray``, and ``nftranspose`` are
used to generate a dense encoding for *nf(ltext)*.  This
allows ``_deltas`` to calculate *sum1* and *sum2* using
matrices, which yields a significant performance improvement.

:param train_toks: The set of training tokens.
:type train_toks: list(tuple(dict, str))
:param classifier: The current classifier.
:type classifier: ClassifierI
:param ffreq_empirical: An array containing the empirical
    frequency for each feature.  The *i*\ th element of this
    array is the empirical frequency for feature *i*.
:type ffreq_empirical: sequence of float
:param unattested: An array that is 1 for features that are
    not attested in the training data; and 0 for features that
    are attested.  In other words, ``unattested[i]==0`` iff
    ``ffreq_empirical[i]==0``.
:type unattested: sequence of int
:param nfmap: A map that can be used to compress ``nf`` to a dense
    vector.
:type nfmap: dict(int -> int)
:param nfarray: An array that can be used to uncompress ``nf``
    from a dense vector.
:type nfarray: array(float)
:param nftranspose: The transpose of ``nfarray``
:type nftranspose: array(float)
gê-�™—q=i,  rO  c              3   ó*   "  € T F	  w  rVx € K  	  R # 5ir!   rF   rƒ  s   &  r   rI   Ú#calculate_deltas.<locals>.<genexpr>T  s   é € Ð9©.™Y˜b•S«.ùr#  )Úaxis)r[  Úonesr   r]  r   r,   r"   r5   r$  rZ   rv   ÚouterrO   )r�   rk  rj  Úffreq_empiricalr}  r~  r  r   ÚNEWTON_CONVERGEÚ
MAX_NEWTONr€  ÚAr  r7   Údistr8   rˆ  r„  rt  ÚrangenumÚnf_deltaÚexp_nf_deltaÚnf_exp_nf_deltaÚsum1Úsum2rr   Ún_errors   &&&&&&&&                   r   r{  r{  ú  s   € ðR €OØ€Jä�ZŠZ˜Ÿ™Ó)¨3Ó/€Fô
 	�Š”S˜“Z §¡Ó!2Ð3°SÓ9€Aã ‰
ˆØ×'Ñ'¨Ó,ˆà—_‘_Ö&ˆEà%Ÿ_™_¨SÓ8ˆNäÑ9©.Ó9Ó9ˆBã)‘��CØ˜•)˜R�-×  D§I¡I¨eÓ$4°sÕ$:Õ:Õ ó *ó 'ñ !ð ŒˆZ‹Õ€Aô ˜*Ö%ˆÜ—;’;˜wÓ/ˆØ˜(•{ˆØ%¨Õ4ˆÜ�yŠy˜¨Õ)°Ô2ˆÜ�yŠy˜¨1Õ,°1Ô5ˆó ˆCØ��I˜�N�Iñ ð 	 TÕ)¨d¨UÕ2Õ2ˆô —)’)œC °$Õ 6Ó7Ó8¼5¿9º9ÄSÈÃ[Ó;QÕQˆØ�_Ö$ØŠMñ# &ð& €Mr   c           
     óô  € RpRpRV9   d
   VR,          pRV9   d
   VR,          pVf,   VP                  R^ 4      p\        P                  WVRR7      pMVe   \        R4      h \        P
                  ! RR	7      w  rš\        V
R
4      ;_uu_ 4       p\        WW¶VR7       RRR4       \        P                  ! V	4       . pT. RO,          pT'       d   TR.,          pT'       g   TR.,          pT'       d   RT^,          ,          pM^ pTRRT,          R.,          pT^8  d   TR.,          pRT9   d   TRRTR,          ,          .,          pRT9   d#   TRR\        TR,          4      ,          .,          p\        TR4      '       d   TR.,          pTRT
.,          p\        T4      p \        P                  ! T
4       \!        YòP#                  4       T4      pT\$        P&                  ! \$        P(                  4      ,          p\+        TT4      #   + '       g   i     ELz; i  \        \        3 d   p\        RT,          4      ThRp?ii ; i  \         d   p\        RT
 RT 24        Rp?L²Rp?ii ; i)a{  
Train a new ``ConditionalExponentialClassifier``, using the given
training samples, using the external ``megam`` library.  This
``ConditionalExponentialClassifier`` will encode the model that
maximizes entropy from all the models that are empirically
consistent with ``train_toks``.

:see: ``train_maxent_classifier()`` for parameter descriptions.
:see: ``nltk.classify.megam``
Tr’   r“   Nr�   )r"   rç   z$Specify encoding or labels, not bothznltk-©ÚprefixÚw)r’   r“   z,Error while creating megam training file: %sz	-explicitz-fvalsr2   z-lambdaz%.2fz-tunez-quietr‹   z-maxirD   Úll_deltaz-dppÚcostz-multilabelÚ
multiclasszWarning: unable to delete z: )z-nobiasz-repeatÚ10)ÚgetrÛ   rš   r›   ÚtempfileÚmkstempÚopenr   ÚosÚcloseÚOSErrorrO   rt   r   Úremover_   r   r   r[  r`  Úer   )r�   r‰   r   r"   rŠ   r    r’   r“   r�   ÚfdÚtrainfile_nameÚ	trainfiler«  r  Úinv_varianceÚstdoutr   s   &&&&&,           r   r˜   r˜   �  si  € ð €HØ€IØ�VÔØ˜*Õ%ˆØ�fÔØ˜;Õ'ˆ	ð Òð —z‘z .°!Ó4ˆÜ.×4Ñ4Ø¨VÀtð 5ó 
‰ð 
Ò	ÜÐ?Ó@Ð@ðTÜ%×-Ò-°WÔ=ÑˆÜ�. #×&Ô&¨)ÜØ iÈiõ÷ 'ô 	�Š�Œð
 €GØÒ+Õ+€GßØ�K�=Õ ˆßØ�H�:Õˆßð Ð1°1Õ4Õ4‰àˆØ�	˜6 LÕ0°'Ð:Õ:€GØˆq„yØ�H�:ÕˆØ�VÔØ�G˜T F¨:Õ$6Õ6Ð7Õ7ˆØ�VÔð 	�F˜D¤3 v¨jÕ'9Ó#:Õ:Ð;Õ;ˆÜˆx˜× Ò Ø�M�?Õ"ˆØ�˜nÐ-Õ-€GÜ˜Ó €FðBÜ
�	Š	�.Ô!ô
 " &¯/©/Ó*;¸XÓF€Gð Œu�zŠzœ%Ÿ'™'Ó"Õ"€Gô ˜H gÓ.Ð.÷c '×&Ð&ûô
 ”ZÐ ô TÜÐGÈ!ÕKÓLÐRSÐSûðTûôD ô BÜÐ*¨>Ð*:¸"¸Q¸CÐ@×AÑAûðBúsH   Á$-H% ÂHÂ H% Æ*I ÈH"	È	H% È%IÈ6I	É	IÉI7ÉI2É2I7c                   ó0   a € ] tR tRt o ]R 4       tRtV tR# )r™   iÝ  c                ó:  € VP                  R R4      pVP                  R^4      pVP                  RR4      pVP                  RR4      pVP                  R^ 4      pVP                  R^ 4      pVP                  R4      p	VP                  R	4      p
V'       g   \        P                  WVR
7      p\        P                  ! RRR7      w  r¼\        P                  ! RR7      w  rÞ\        VR4      p\        WV4       VP                  4        . pVP                  R.4       VP                  RV.4       V'       d"   VP                  RRV^,          ,          .4       V	'       d   VP                  RRV	,          .4       V
'       d$   VP                  RR\        V
4      ,          .4       VP                  RV.4       VP                  RV.4       V^8  d   VP                  R.4       MVP                  R.4       \        V4       \        V4      ;_uu_ 4       p\        V4      pRRR4       \        P                  ! V4       \        P                  ! V4       X\        P                   ! \        P"                  4      ,          pV ! VV4      #   + '       g   i     Lp; i)rž   Útao_lmvmr‰   r   Nr"   rŠ   r�   r‹   r�   rN  znltk-tadm-events-z.gz)r�  Úsuffixznltk-tadm-weights-rœ  rž  z-monitorz-methodz-l2z%.6fz-max_itz%dz-fatolz
-events_inz-params_outz2>&1z-summary)r£  r-  rš   r¤  r¥  r   r	   r¨  ÚextendrO   r   r¦  r   r§  rª  r[  r`  r«  )rœ   r�   r    rž   r‰   r   r"   Úsigmar�   r‹   rŸ  Útrainfile_fdr­  Úweightfile_fdÚweightfile_namer®  r  Ú
weightfiler   s   &&,                r   rš   ÚTadmMaxentClassifier.trainÞ  s  € à—J‘J˜{¨JÓ7ˆ	Ø—
‘
˜7 AÓ&ˆØ—:‘:˜j¨$Ó/ˆØ—‘˜H dÓ+ˆØ—
‘
Ð1°1Ó5ˆØ—z‘z .°!Ó4ˆØ—:‘:˜jÓ)ˆØ—:‘:˜mÓ,ˆ÷ Ü5×;Ñ;Ø°ð <ó ˆHô (0×'7Ò'7Ø&¨uô(
Ñ$ˆô *2×)9Ò)9ÐAUÔ)VÑ&ˆä% n°cÓ:ˆ	Ü˜
¨iÔ8Ø�‰ÔàˆØ�‰˜
�|Ô$Ø�‰˜	 9Ð-Ô.ßØ�N‰N˜E 6¨E°1­HÕ#4Ð5Ô6ßØ�N‰N˜I t¨h¥Ð7Ô8ßØ�N‰N˜H f¬s°8«}Õ&<Ð=Ô>Ø�‰˜ nÐ5Ô6Ø�‰˜ Ð7Ô8Ø�1Œ9Ø�N‰N˜F˜8Õ$à�N‰N˜J˜<Ô(ä�'Ôä�/×"Ô" jÜ(¨Ó4ˆG÷ #ô 	�	Š	�.Ô!Ü
�	Š	�/Ô"ð 	”5—:’:œeŸg™gÓ&Õ&ˆñ �8˜WÓ%Ð%÷ #×"ús   ÈJ
Ê
J	rF   N)rª   r«   r¬   r­   r°   rš   r±   r²   r³   s   @r   r™   r™   Ý  s   ø‡ € Øñ5&ó ö5&r   r™   c                 ó¢  € ^ RI p^ RIHp V! 4       p\        V  R24      ;_uu_ 4       pVP                  ! \        \        VP                  VP                  V4      4      4      4      pRRR4       \        V  R24      ;_uu_ 4       pVP                  V4      pRRR4       \        V  R24      ;_uu_ 4       pVP                  V4      pRRR4       \        V  R24      ;_uu_ 4       pVP                  V4      pRRR4       XXXX3#   + '       g   i     L¦; i  + '       g   i     L‰; i  + '       g   i     Ll; i  + '       g   i     LO; i)rM   N)ÚMaxentDecoderú/weights.txtú/mapping.tabú/labels.txtú/alwayson.tab)r[  Únltk.tabdatar½  r¦  rx  ru   ÚmapÚfloat64Útxt2listÚtupkey2dictÚ
tab2ivdict)	Útab_dirr[  r½  Úmdecr   ÚwgtÚmpgÚlabÚaons	   &        r   Úload_maxent_paramsrÎ    s  € Ûå*á‹?€Dä	��	˜Ð&×	'Ô	'¨1Ø�kŠkœ$œs 5§=¡=°$·-±-ÀÓ2BÓCÓDÓEˆ÷ 
(ô 
��	˜Ð&×	'Ô	'¨1Ø×Ñ˜qÓ!ˆ÷ 
(ô 
��	˜Ð%×	&Ô	&¨!Ø�m‰m˜AÓˆ÷ 
'ô 
��	˜Ð'×	(Ô	(¨AØ�o‰o˜aÓ ˆ÷ 
)ð ��S˜#ÐÐ÷ 
(×	'ú÷ 
(×	'ú÷ 
'×	&ú÷ 
)×	(ús/   ¨?DÂDÂ5D+Ã%D>ÄD	ÄD(	Ä+D;	Ä>E	c                 óZ  € ^ RI Hp ^ RIHp ^ RIHp V! 4       pV! V4      '       g	   V! V4       \        RV 24       \        V R2R4      ;_uu_ 4       p	V	P                  VP                  \        \        V P                  4       4      4       4       RRR4       \        V R2R4      ;_uu_ 4       p	V	P                  VP                  V4       4       RRR4       \        V R	2R4      ;_uu_ 4       p	V	P                  VP                  V4       4       RRR4       \        V R
2R4      ;_uu_ 4       p	V	P                  VP                  V4       4       RRR4       R#   + '       g   i     LÕ; i  + '       g   i     L§; i  + '       g   i     Ly; i  + '       g   i     R# ; i)rM   )Úmkdir)Úisdir)ÚMaxentEncoderzSaving Maxent parameters in r¾  rž  Nr¿  rÀ  rÁ  )r§  rÐ  Úos.pathrÑ  rÂ  rÒ  r_   r¦  ÚwriteÚlist2txtrÃ  ÚreprÚtolistÚtupdict2tabÚ
ivdict2tab)
rÊ  rË  rÌ  rÍ  rÈ  rÐ  rÑ  rÒ  Úmencr   s
   &&&&&     r   Úsave_maxent_paramsrÛ  2  s1  € åÝå*á‹?€DÙ��>Š>ÙˆgŒä	Ð(¨¨	Ð
2Ô3ä	��	˜Ð&¨×	,Ô	,°Ø	�‰�4—=‘=¤¤T¨3¯:©:«<Ó!8Ó9Ð:Ô<÷ 
-ä	��	˜Ð&¨×	,Ô	,°Ø	�‰�4×#Ñ# CÓ(Ð)Ô+÷ 
-ä	��	˜Ð% s×	+Ô	+¨qØ	�‰�4—=‘= Ó%Ð&Ô(÷ 
,ä	��	˜Ð'¨×	-Ô	-°Ø	�‰�4—?‘? 3Ó'Ð(Ô*÷ 
.Ñ	-÷ 
-×	,úç	,×	,úç	+×	+úç	-×	-Ð	-ús0   Á>E Â2"E3Ã3"FÄ4"FÅ E0	Å3F	ÆF	ÆF*	c                  ó†   € ^ RI Hp  ^ RIHp V ! R4      p\	        V4      w  r4rV\        \        WTVR7      V4      pV! VR7      # )rM   )Úfind)ÚClassifierBasedPOSTaggerz.taggers/maxent_treebank_pos_tagger_tab/english)rç   )rk  )Ú	nltk.datarÝ  Únltk.tag.sequentialrÞ  rÎ  r   rÛ   )rÝ  rÞ  rÈ  rÊ  rË  rÌ  rÍ  Úmcs           r   Úmaxent_pos_taggerrâ  I  sE   € ÝÝ<áÐCÓD€GÜ+¨GÓ4Ñ€CˆcÜ	Ü# CÀÔDÀcó
€Bñ $¨rÔ2Ð2r   c                  ó>   € ^ RI Hp  V ! \        P                  4      pR# )rM   )Ú
names_demoN)Únltk.classify.utilrä  r   rš   )rä  rk  s     r   Údemoræ  X  s   € Ý-áÔ,×2Ñ2Ó3‚Jr   Ú__main__)r©   NN)r©   NNrM   )z/tmp)1r®   r[  ÚImportErrorr§  r¤  Úcollectionsr   Únltk.classify.apir   Únltk.classify.megamr   r   r   Únltk.classify.tadmr   r   r	   rå  r
   r   r   rß  r   Únltk.probabilityr   Ú	nltk.utilr   Ú__docformat__r   r_  r¶   rÈ   rÛ   r  r-  r>  r—   rZ  rd  r–   rw  r{  r˜   r™   rÎ  rÛ  râ  ræ  rª   rF   r   r   Ú<module>rð     s)  ðñ,ðZ	Ûó 
Û Ý #å )ß QÑ Qß MÑ Mß FÑ FÝ 'Ý /Ý !à€ôJA�{ô JAð\ $4Ð  ÷F$ñ F$ôR,*Ð*@ô ,*ô^G/Ð"8ô G/ôT:DÐ-ô :Dôz5/Ð%@ô 5/ôpa/Ð!7ô a/ôR_òDò
ô$Yòx3ò8{ôNT/ôx7&Ð+ô 7&ò~ô,+ò.	3ò4ð ˆzÔÙ†Fñ øðM1 ô 	Ùð	ús   „C" Ã"C,Ã+C,