text:
<?php
namespace Twitter;

class UserTimeline {

	const HTTP_OK = 200;
	const OAUTH_VERSION = '1.0';
	const OAUTH_SIGNATURE_METHOD = 'HMAC-SHA1';
	const OAUTH_HMAC_ALGO = 'SHA1';

	const USER_TIMELINE_API_URL = 'https://api.twitter.com/1.1/statuses/user_timeline.json';
	const USER_TIMELINE_API_HTTP_METHOD = 'GET';

	private $APIKey;
	private $APISecret;
	private $accessToken;
	private $accessTokenSecret;
	private $screenName;

	private $fetchBatchSize = 10;
	private $extendedTweetMode = false;

	public function __construct(
		$APIKey,$APISecret,
		$accessToken,$accessTokenSecret,
		$screenName
	) {

		$this->APIKey = $APIKey;
		$this->APISecret = $APISecret;
		$this->accessToken = $accessToken;
		$this->accessTokenSecret = $accessTokenSecret;
		$this->screenName = $screenName;
	}

	public function setFetchBatchSize($size) {

		$this->fetchBatchSize = $size;
	}

	public function setExtendedTweetMode($enabled) {

		$this->extendedTweetMode = $enabled;
	}

	public function resultList($sinceTweetID = false) {

		$lastTweetID = 0;

		while ($lastTweetID !== false) {
			$GETList = [
				'count' => $this->fetchBatchSize,
				'screen_name' => $this->screenName
			];

			// after tweets in extended (more than 140chars) mode?
			if ($this->extendedTweetMode) {
				$GETList['tweet_mode'] = 'extended';
			}

			// only get tweets AFTER a given tweet ID?
			if ($sinceTweetID !== false) {
				$GETList['since_id'] = $sinceTweetID;
			}

			// if a subsequent tweet fetch API call, only get tweets older than the last one digested
			if ($lastTweetID) {
				$GETList['max_id'] = ($lastTweetID - 1);
			}

			// make request
			list($responseHTTPCode,$responseBody) = $this->execOAuthRequest(
				self::USER_TIMELINE_API_HTTP_METHOD,
				self::USER_TIMELINE_API_URL,
				$GETList
			);

			if ($responseHTTPCode != self::HTTP_OK) {
				// response error
				throw new \Exception('Twitter fetch user timeline error');
			}

			// yield results
			$lastTweetID = false;
			foreach (json_decode($responseBody,true) as $tweetData) {
				yield $this->resultListParseTweet($tweetData);

				// save current tweet ID for next API fetch block
				$lastTweetID = $tweetData['id'];
			}
		}
	}

	private function resultListParseTweet(array $tweetData) {

		// get retweet status
		$isRetweet = isset($tweetData['retweeted_status']);
		$tweetSource = ($isRetweet) ? $tweetData['retweeted_status'] : $tweetData;

		// parse tweet entities - hashtags/urls/user mentions/media (optional)
		$tweetEntities = [];
		foreach ($tweetSource['entities'] as $entityType => $entityCollection) {
			if (!$entityCollection) {
				// if no data in entity collection, skip
				continue;
			}

			// parse entity based on its type
			if ($entityType == 'hashtags') {
				foreach ($entityCollection as $entityItem) {
					// add hash tag entity
					$tweetEntities[] = [
						'type' => 'hashtag',
						'indices' => $entityItem['indices'],
						'text' => $entityItem['text']
					];
				}

			} elseif ($entityType == 'urls') {
				foreach ($entityCollection as $entityItem) {
					// add url entity
					$tweetEntities[] = [
						'type' => 'url',
						'indices' => $entityItem['indices'],
						'text' => $entityItem['url'],
						'url' => trim($entityItem['expanded_url']),
					];
				}

			} elseif ($entityType == 'user_mentions') {
				foreach ($entityCollection as $entityItem) {
					// add user mention
					$tweetEntities[] = [
						'type' => 'user',
						'indices' => $entityItem['indices'],
						'text' => $entityItem['screen_name'],
						'userID' => $entityItem['id'],
						'userFullName' => trim($entityItem['name'])
					];
				}

			} elseif ($entityType == 'media') {
				foreach ($entityCollection as $entityItem) {
					// add twitter media item
					$tweetEntities[] = [
						'type' => 'media',
						'indices' => $entityItem['indices'],
						'text' => $entityItem['url'],
						'url' => trim($entityItem['expanded_url'])
					];
				}
			}
		}

		// order entities by their position in the tweet text
		usort($tweetEntities,function($a,$b) {

			$a = $a['indices'][0];
			$b = $b['indices'][0];

			if ($a == $b) {
				return 0;
			}

			return ($a < $b) ? -1 : 1;
		});

		// return parsed tweet data item:
		// - tweet ID, created unix timestamp, publishing user details
		// - tweet text, reply to ID, is retweet flag
		// - tweet entities
		$isReplyTo = ($tweetSource['in_reply_to_status_id'] !== null);

		// fetch either default (140 chars or less), or extended text for tweet
		$tweetText = ($this->extendedTweetMode)
			? $tweetSource['full_text']
			: $tweetSource['text'];

		return [
			'ID' => $tweetData['id'],
			'created' => strtotime($tweetData['created_at']),
			'userID' => $tweetSource['user']['id'],
			'userFullName' => $tweetSource['user']['name'],
			'userScreenName' => $tweetSource['user']['screen_name'],
			'text' => trim(
				preg_replace(
					'/ +/',' ',
					htmlspecialchars_decode($tweetText)
				)
			),
			'replyToID' => ($isReplyTo) ? $tweetSource['in_reply_to_status_id'] : false,
			'replyToUserID' => ($isReplyTo) ? $tweetSource['in_reply_to_user_id'] : false,
			'replyToUserScreenName' => ($isReplyTo) ? $tweetSource['in_reply_to_screen_name'] : false,
			'retweetCreated' => ($isRetweet) ? strtotime($tweetSource['created_at']) : false,
			'entityList' => $tweetEntities
		];
	}

	private function execOAuthRequest($HTTPMethod,$URL,array $GETList = [],array $POSTList = []) {

		$getURLEncodedList = function(array $parameterList,$isPOST = false) {

			if (!$parameterList) {
				return '';
			}

			// convert $parameterList to url encoded key=value pairs
			array_walk($parameterList,function(&$value,$key) {

				$value = urlencode($key) . '=' . urlencode($value);
			});

			return (($isPOST) ? '' : '?') . implode('&',$parameterList);
		};

		$curlConn = curl_init();

		curl_setopt_array(
			$curlConn,[
				CURLOPT_HEADER => false, // no header to be returned in response
				CURLOPT_HTTPHEADER => [
					$this->buildOAuthHTTPAuthorizationHeader($HTTPMethod,$URL,$GETList,$POSTList)
				],
				CURLOPT_POST => ($POSTList) ? true : false,
				CURLOPT_RETURNTRANSFER => true,
				CURLOPT_URL => $URL . $getURLEncodedList($GETList)
			]
		);

		if ($POSTList) {
			// add POST data to request
			curl_setopt(
				$curlConn,CURLOPT_POSTFIELDS,
				$getURLEncodedList($POSTList,true)
			);
		}

		// make request, close curl session
		$responseBody = curl_exec($curlConn);
		$responseHTTPCode = curl_getinfo($curlConn,CURLINFO_HTTP_CODE);
		curl_close($curlConn);

		// return HTTP code and response body
		return [$responseHTTPCode,$responseBody];
	}

	private function buildOAuthHTTPAuthorizationHeader($HTTPMethod,$URL,array $GETList,array $POSTList) {

		// build source data list in key/value pairs
		$OAuthParameterList = [
			'oauth_consumer_key' => $this->APIKey,
			'oauth_nonce' => md5(microtime() . mt_rand()),
			'oauth_signature_method' => self::OAUTH_SIGNATURE_METHOD,
			'oauth_timestamp' => time(),
			'oauth_token' => $this->accessToken,
			'oauth_version' => self::OAUTH_VERSION
		];

		// create OAuth signature
		$OAuthParameterList['oauth_signature'] = $this->buildOAuthHTTPSignature(
			$HTTPMethod,$URL,
			$OAuthParameterList + $GETList + $POSTList
		);

		// build OAuth authorization header and return
		$authItemList = [];
		foreach ($OAuthParameterList as $key => $value) {
			$authItemList[] = sprintf('%s="%s"',rawurlencode($key),rawurlencode($value));
		}

		return 'Authorization: OAuth ' . implode(', ',$authItemList);
	}

	private function buildOAuthHTTPSignature($HTTPMethod,$URL,array $parameterList) {

		$getRawURLEncodeList = function(array $dataList) {

			foreach ($dataList as &$dataItem) {
				$dataItem = rawurlencode($dataItem);
			}

			return $dataList;
		};

		// rawurlencode each key/value pair
		$parameterList = array_combine(
			$getRawURLEncodeList(array_keys($parameterList)),
			$getRawURLEncodeList(array_values($parameterList))
		);

		// alpha sort on keys and build parameter string data
		uksort($parameterList,'strcmp');

		$parameterDataList = [];
		foreach ($parameterList as $key => $value) {
			$parameterDataList[] = $key . '=' . $value;
		}

		// calculate signature and return
		return base64_encode(hash_hmac(
			// signature base
			self::OAUTH_HMAC_ALGO,
			implode('&',[
				$HTTPMethod,rawurlencode($URL),
				rawurlencode(implode('&',$parameterDataList))
			]),
			// signing key
			rawurlencode($this->APISecret) . '&' . rawurlencode($this->accessTokenSecret),
			true
		));
	}
}


text:
	#error include 'stdafx.h' before including this file for PCH
#endif

#include "resource.h"       // main symbols
#include "Control/NIControl.h"
#include "gui/Keypad.h"
#include "MainRunSeq.h"
#include "CheckSensorRunSeq.h"

#define MONITORING_TIMER_ID				0

#define WM_PROCESS_LOG					WM_USER + 1

#define PROCESS_LOG(M)					::SendMessage(this->m_hWnd, WM_PROCESS_LOG, NULL, (LPARAM)M)

/////////////////////////////////////////////////////////////////////////////
// CNIMotionTestApp:
// See NIMotionTest.cpp for the implementation of this class
//

class CNIMotionTestApp : public CWinApp
{
public:
	CNIMotionTestApp();

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CNIMotionTestApp)
	public:
	virtual BOOL InitInstance();
	virtual int ExitInstance();
	//}}AFX_VIRTUAL

// Implementation
	//{{AFX_MSG(CNIMotionTestApp)
	afx_msg void OnAppAbout();
		// NOTE - the ClassWizard will add and remove member functions here.
		//    DO NOT EDIT what you see in these blocks of generated code !
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_NIMOTIONTEST_H__7CA20EDC_01AD_4BD9_AB78_3A8D9EF24189__INCLUDED_)

redpajama_set_name: RedPajamaGithub


text:
package org.apache.ignite.internal.commandline;

import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import org.apache.ignite.internal.util.typedef.F;
import org.jetbrains.annotations.NotNull;

/**
 * Iterator over command arguments.
 */
public class CommandArgIterator {
    /** */
    private Iterator<String> argsIt;

    /** */
    private String peekedArg;

    /**
     * Set of common arguments names and high level command name set.
     */
    private final Set<String> commonArgumentsAndHighLevelCommandSet;

    /**
     * @param argsIt Raw argument iterator.
     * @param commonArgumentsAndHighLevelCommandSet All known subcomands.
     */
    public CommandArgIterator(Iterator<String> argsIt, Set<String> commonArgumentsAndHighLevelCommandSet) {
        this.argsIt = argsIt;
        this.commonArgumentsAndHighLevelCommandSet = commonArgumentsAndHighLevelCommandSet;
    }

    /**
     * @return Returns {@code true} if the iteration has more elements.
     */
    public boolean hasNextArg() {
        return peekedArg != null || argsIt.hasNext();
    }

    /**
     * @return true if there's next argument for subcommand.
     */
    public boolean hasNextSubArg() {
        return hasNextArg() && CommandList.of(peekNextArg()) == null &&
            !commonArgumentsAndHighLevelCommandSet.contains(peekNextArg());
    }

    /**
     * Extract next argument.
     *
     * @param err Error message.
     * @return Next argument value.
     */
    public String nextArg(String err) {
        if (peekedArg != null) {
            String res = peekedArg;

            peekedArg = null;

            return res;
        }

        if (argsIt.hasNext())
            return argsIt.next();

        throw new IllegalArgumentException(err);
    }

    /**
     * Returns the next argument in the iteration, without advancing the iteration.
     *
     * @return Next argument value or {@code null} if no next argument.
     */
    public String peekNextArg() {
        if (peekedArg == null && argsIt.hasNext())
            peekedArg = argsIt.next();

        return peekedArg;
    }

    /**
     * @return Numeric value.
     */
    public long nextNonNegativeLongArg(String argName) {
        long val = nextLongArg(argName);

        if (val < 0)
            throw new IllegalArgumentException("Invalid value for " + argName + ": " + val);

        return val;
    }

    /**
     * @return Numeric value.
     */
    public int nextNonNegativeIntArg(String argName) {
        int val = nextIntArg(argName);

        if (val < 0)
            throw new IllegalArgumentException("Invalid value for " + argName + ": " + val);

        return val;
    }

    /**
     * @return Numeric value.
     */
    public long nextLongArg(String argName) {
        String str = nextArg("Expecting " + argName);

        try {
            return str.startsWith("0x") ? Long.parseLong(str.substring(2), 16) : Long.parseLong(str);
        }
        catch (NumberFormatException ignored) {
            throw new IllegalArgumentException("Invalid value for " + argName + ": " + str);
        }
    }

    /**
     * @return Numeric value.
     */
    public int nextIntArg(String argName) {
        String str = nextArg("Expecting " + argName);

        try {
            return str.startsWith("0x") ? Integer.parseInt(str.substring(2), 16) : Integer.parseInt(str);
        }
        catch (NumberFormatException ignored) {
            throw new IllegalArgumentException("Invalid value for " + argName + ": " + str);
        }
    }

    /**
     * @param argName Name of argument.
     */
    public Set<String> nextStringSet(String argName) {
        String nextArg = peekNextArg();

        if (isCommandOrOption(nextArg))
            return Collections.emptySet();

        nextArg = nextArg("Expected " + argName);

        return parseStringSet(nextArg);
    }

    /**
     *
     * @param string To scan on for string set.
     * @return Set of string parsed from string param.
     */
    @NotNull public Set<String> parseStringSet(String string) {
        Set<String> namesSet = new HashSet<>();

        for (String name : string.split(",")) {
            if (F.isEmpty(name))
                throw new IllegalArgumentException("Non-empty string expected.");

            namesSet.add(name.trim());
        }
        return namesSet;
    }

    /**
     * Check if raw arg is command or option.
     *
     * @return {@code true} If raw arg is command, overwise {@code false}.
     */
    public static boolean isCommandOrOption(String raw) {
        return raw != null && raw.contains("--");
    }
}


text:
import pandas as pd
import math, string, sys
from pandas import DataFrame
from sklearn.feature_extraction.text import CountVectorizer,TfidfVectorizer
from urlparse import urlparse, parse_qs
import logging

logging.basicConfig()

def build_vectorizers(df, ftu, max_features=100, ngram_size=7, verbose=False):
    """
      Build some vectorizers based on an enhanced http dataframe

      Parameters
      ----------
      df : dataframe
          The enhanced HTTP log dataframe
      max_features : int, optional
          the most features per bag to use. Default 100
      ngram_size : int, optional
          The size of ngrams to use for bag of ngrams. Defaults to 7
      verbose: boolean, optional
          Controls Verbosity level
      ftu: fields to use
          Controls which fields to be used.

      Returns
      -------
      vectorizers : {String -> TfidfVectorizer}
            A map of feature -> vectorizer for use in the featureize function.

    """
    print('\nBuilding Vectorizers')
    vectorizers = {}
    #create bag of ngram vectorizers
    for feature in ['user_agent','uri','referrer','host', 'subdomain']:
      if feature in ftu:
        if verbose: print('Creating BON Vectorizer for %s' % feature)
        vectorizer = TfidfVectorizer(analyzer='char',max_features = max_features,ngram_range=(ngram_size,ngram_size))
        vectorizers[feature] = vectorizer.fit(df[feature].astype(str))

    #create bag of words vectorizers
    for feature in ['method','status_code','resp_p', 'URIparams', 'browser_string', 'tld']:
    #for feature in ['method','status_code']:
      if feature in ftu:
        if verbose: print('Creating BOW Vectorizer for %s' % feature)
        vectorizer = TfidfVectorizer(analyzer='word',max_features = max_features)
        vectorizers[feature] = vectorizer.fit(df[feature].astype(str))

    return vectorizers

def featureize(df, ftu, vectorizers, verbose=False):
    # type: (object, object, object) -> object
    """
      Featurize an enhanced http dataframe

      Parameters
      ----------
      df : dataframe
          The enhanced HTTP log dataframe
      vectorizers : {String -> TfidfVectorizer}
            A map of feature -> vectorizer
      verbose: boolean, optional
          Controls Verbosity level

      Returns
      -------
      featureMatrix : numeric dataframe
            A featurized dataframe

    """
    if verbose: print('\nExtracting features')

    bow_features = []
    #featurize using the vectorizers.

    for feature in ['user_agent','uri','referrer','host', 'subdomain', 'method','status_code','resp_p', 'URIparams', 'browser_string', 'tld']:
    #for feature in ['user_agent', 'method', 'status_code']:
      if feature in ftu:
        if verbose: print('Featurizing %s' % feature)
        single_feature_matrix = vectorizers[feature].transform(df[feature].astype(str))
        if verbose: print('  Dim of %s: %s' % (feature,single_feature_matrix.shape[1]))
        single_df = DataFrame(single_feature_matrix.toarray())
        single_df.rename(columns=lambda x: feature+"."+vectorizers[feature].get_feature_names()[x], inplace=True)
        bow_features.append(single_df)

    featureMatrix = pd.concat(bow_features, axis=1)

    #add some other numeric features that are functions of columns
    if 'domainNameLength' in ftu:
      featureMatrix['domainNameLength'] = df['host'].apply(len)
    if 'domainNameDots' in ftu:
      featureMatrix['domainNameDots'] = df['host'].apply(lambda dn: dn.count('.'))
    if 'uriSlashes' in ftu:
      featureMatrix['uriSlashes'] = df['uri'].apply(lambda dn: dn.count('/'))

    if 'userAgentLength' in ftu:
      featureMatrix['userAgentLength'] = df['user_agent'].apply(len)
    if 'userAgentEntropy' in ftu:
      featureMatrix['userAgentEntropy'] = df['user_agent'].apply(H)

    if 'subdomain' in ftu:
      featureMatrix['subdomainEntropy'] = df['subdomain'].apply(H)
    if 'request_body_len' in ftu:
      featureMatrix['request_body_len'] = df['request_body_len']
    if 'response_body_len' in ftu:
      featureMatrix['response_body_len'] = df['response_body_len']

    if 'referrerPresent' in ftu:
      featureMatrix['referrerPresent'] = df['referrer'].apply(lambda r: 0.0 if (r=='-') else 1.0)

    def countParams(uri):
        fullUri = 'http://bogus.com/'+uri
        parseResult = parse_qs(urlparse(fullUri).query)
        return len(parseResult)

    if 'numURIParams' in ftu:
      featureMatrix['numURIParams'] = df['uri'].apply(countParams)

    if 'URIparams' in ftu:
      featureMatrix['URIParamsKeyEntropy'] = df['URIparams'].apply(H)
    if 'URItokens' in ftu:
      featureMatrix['URIParamsTokensEntropy'] = df['URItokens'].apply(H)

    if verbose: print('Feature matrix generated with %s columns' % featureMatrix.shape[1])

    return featureMatrix

# Some functions to compute entropy of strings
#
# Borrowed from Ero Carrera
# http://blog.dkbza.org/2007/05/scanning-data-for-entropy-anomalies.html
def range_bytes (): return range(256)
def range_printable(): return (ord(c) for c in string.printable)
def H(data, iterator=range_bytes):
    if not data:
        return 0
    entropy = 0
    for x in iterator():
        p_x = float(data.count(chr(x)))/len(data)
        if p_x > 0:
            entropy += - p_x*math.log(p_x, 2)
    return entropy


text:
ACCEPTED

#### According to
International Plant Names Index

#### Published in
Abh. Königl. Ges. Wiss. Göttingen 19:235; Pl. lorentz. 187. 1874

#### Original name
Bystropogon mollis Kunth

### Remarks
null


text:
set -e
set -o pipefail

# Run unit tests
echo "Running benchmarks"
pushd ./build/bench/bin

for file in *.out
    do
        echo "Running ${file}"
        ./$file
    done
popd


text:
class NdefRecord
{
    public:
        NdefRecord();
        NdefRecord(const NdefRecord& rhs);
        ~NdefRecord();
        NdefRecord& operator=(const NdefRecord& rhs);

        int getEncodedSize();
        void encode(byte *data, bool firstRecord, bool lastRecord);

        unsigned int getTypeLength();
        int getPayloadLength();
        unsigned int getIdLength();

        byte getTnf();
        void getType(byte *type);
        void getPayload(byte *payload);
        void getId(byte *id);

        // convenience methods
        String getType();
        String getId();

        void setTnf(byte tnf);
        void setType(const byte *type, const unsigned int numBytes);
        void setPayload(const byte *payload, const int numBytes);
        void setId(const byte *id, const unsigned int numBytes);

        void print();
    private:
        byte getTnfByte(bool firstRecord, bool lastRecord);
        byte _tnf; // 3 bit
        unsigned int _typeLength;
        int _payloadLength;
        unsigned int _idLength;
        byte *_type;
        byte *_payload;
        byte *_id;
};

#endif


text:
package com.amazonaws.services.connect.model;

import java.io.Serializable;
import javax.annotation.Generated;

import com.amazonaws.AmazonWebServiceRequest;

/**
 *
 * @see AWS API
 *      Documentation
 */
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class StopContactRequest extends com.amazonaws.AmazonWebServiceRequest implements Serializable, Cloneable {

    /**
     *

     * The unique identifier of the contact to end.
     *

     */
    private String contactId;
    /**
     *

     * The identifier for your Amazon Connect instance. To find the ID of your instance, open the AWS console and select
     * Amazon Connect. Select the alias of the instance in the Instance alias column. The instance ID is displayed in
     * the Overview section of your instance settings. For example, the instance ID is the set of characters at the end
     * of the instance ARN, after instance/, such as 10a4c4eb-f57e-4d4c-b602-bf39176ced07.
     *

     */
    private String instanceId;

    /**
     *

     * The unique identifier of the contact to end.
     *

     *
     * @param contactId
     *        The unique identifier of the contact to end.
     */

    public void setContactId(String contactId) {
        this.contactId = contactId;
    }

    /**
     *

     * The unique identifier of the contact to end.
     *

     *
     * @return The unique identifier of the contact to end.
     */

    public String getContactId() {
        return this.contactId;
    }

    /**
     *

     * The unique identifier of the contact to end.
     *

     *
     * @param contactId
     *        The unique identifier of the contact to end.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public StopContactRequest withContactId(String contactId) {
        setContactId(contactId);
        return this;
    }

    /**
     *

     * The identifier for your Amazon Connect instance. To find the ID of your instance, open the AWS console and select
     * Amazon Connect. Select the alias of the instance in the Instance alias column. The instance ID is displayed in
     * the Overview section of your instance settings. For example, the instance ID is the set of characters at the end
     * of the instance ARN, after instance/, such as 10a4c4eb-f57e-4d4c-b602-bf39176ced07.
     *

     *
     * @param instanceId
     *        The identifier for your Amazon Connect instance. To find the ID of your instance, open the AWS console and
     *        select Amazon Connect. Select the alias of the instance in the Instance alias column. The instance ID is
     *        displayed in the Overview section of your instance settings. For example, the instance ID is the set of
     *        characters at the end of the instance ARN, after instance/, such as 10a4c4eb-f57e-4d4c-b602-bf39176ced07.
     */

    public void setInstanceId(String instanceId) {
        this.instanceId = instanceId;
    }

    /**
     *

     * The identifier for your Amazon Connect instance. To find the ID of your instance, open the AWS console and select
     * Amazon Connect. Select the alias of the instance in the Instance alias column. The instance ID is displayed in
     * the Overview section of your instance settings. For example, the instance ID is the set of characters at the end
     * of the instance ARN, after instance/, such as 10a4c4eb-f57e-4d4c-b602-bf39176ced07.
     *

     *
     * @return The identifier for your Amazon Connect instance. To find the ID of your instance, open the AWS console
     *         and select Amazon Connect. Select the alias of the instance in the Instance alias column. The instance ID
     *         is displayed in the Overview section of your instance settings. For example, the instance ID is the set
     *         of characters at the end of the instance ARN, after instance/, such as
     *         10a4c4eb-f57e-4d4c-b602-bf39176ced07.
     */

    public String getInstanceId() {
        return this.instanceId;
    }

    /**
     *

     * The identifier for your Amazon Connect instance. To find the ID of your instance, open the AWS console and select
     * Amazon Connect. Select the alias of the instance in the Instance alias column. The instance ID is displayed in
     * the Overview section of your instance settings. For example, the instance ID is the set of characters at the end
     * of the instance ARN, after instance/, such as 10a4c4eb-f57e-4d4c-b602-bf39176ced07.
     *

     *
     * @param instanceId
     *        The identifier for your Amazon Connect instance. To find the ID of your instance, open the AWS console and
     *        select Amazon Connect. Select the alias of the instance in the Instance alias column. The instance ID is
     *        displayed in the Overview section of your instance settings. For example, the instance ID is the set of
     *        characters at the end of the instance ARN, after instance/, such as 10a4c4eb-f57e-4d4c-b602-bf39176ced07.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public StopContactRequest withInstanceId(String instanceId) {
        setInstanceId(instanceId);
        return this;
    }

    /**
     * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
     * redacted from this string using a placeholder value.
     *
     * @return A string representation of this object.
     *
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getContactId() != null)
            sb.append("ContactId: ").append(getContactId()).append(",");
        if (getInstanceId() != null)
            sb.append("InstanceId: ").append(getInstanceId());
        sb.append("}");
        return sb.toString();
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;

        if (obj instanceof StopContactRequest == false)
            return false;
        StopContactRequest other = (StopContactRequest) obj;
        if (other.getContactId() == null ^ this.getContactId() == null)
            return false;
        if (other.getContactId() != null && other.getContactId().equals(this.getContactId()) == false)
            return false;
        if (other.getInstanceId() == null ^ this.getInstanceId() == null)
            return false;
        if (other.getInstanceId() != null && other.getInstanceId().equals(this.getInstanceId()) == false)
            return false;
        return true;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;

        hashCode = prime * hashCode + ((getContactId() == null) ? 0 : getContactId().hashCode());
        hashCode = prime * hashCode + ((getInstanceId() == null) ? 0 : getInstanceId().hashCode());
        return hashCode;
    }

    @Override
    public StopContactRequest clone() {
        return (StopContactRequest) super.clone();
    }

}


text:
'use strict';

const {evaluate, Bayes, sample} = require('../index');

// train data and test

let bayes = new Bayes();

bayes.train({'fun': 3, 'couple': 1}, 'comedy');
bayes.train({'couple': 1, 'fast': 1, 'fun': 3}, 'comedy');
bayes.train({'fast': 3, 'furious': 2, 'shoot': 2}, 'action');
bayes.train({'furious': 2, 'shoot': 4, 'fun': 1}, 'action');
bayes.train({'fly': 2, 'fast': 3, 'shoot': 2, 'love': 1}, 'action');

let result = bayes.test({'fun': 3, 'fast': 3, 'shoot': 2}, {score: true});
console.log(result);

// train bulk data and evaluate result

bayes = new Bayes();

const bulk = sample.bbc();

bayes.train(bulk.dataset, bulk.labels);
result = bayes.test(bulk.dataset, {score: false});

let evaluation = evaluate.accuracy(bulk.labels, result);

console.log(evaluation.micro.PRECISION);