import json
from watson_developer_cloud import RelationshipExtractionV1Beta as RelationshipExtraction


relationship_extraction = RelationshipExtraction(username='******',
                                                 password='******')

print(json.dumps(relationship_extraction.extract("Hello from IBM Watson", return_type='json'), indent=2))
Example #2
0
        sid = arg
    elif opt in ("-r", "---return_type"):
        return_type = arg
    elif opt == '-d':
        DEBUG = True

if not sid:
    print('Required argument missing.')
    usage()
    sys.exit(2)
    
try:
    sys.stdout.write('Watson Relationship Extraction app. (Ctrl-z for terminating.)\n')
    
    # create classifiers with the training data
    relationship_extraction = RelationshipExtraction(username=reConstants.getUsername(), password=reConstants.getPassword())

    # set input encoding - change the encoding name according your platform
    sys.stdin  = codecs.getreader('shift_jis')(sys.stdin)
    
    # loop for classify texts
    sys.stdout.write('Your input> ')
    for line in iter(sys.stdin.readline, ''):
        line = line.rstrip()
        if line != "":
            # send input message - encoding will be done in the SDK
            res = relationship_extraction.extract(line, sid, return_type)
            sys.stdout.write('Response: \n%s\n' % json.dumps(res, indent=2))
                
        sys.stdout.write('Your input> ')
Example #3
0
    elif opt in ("-r", "---return_type"):
        return_type = arg
    elif opt == '-d':
        DEBUG = True

if not sid:
    print('Required argument missing.')
    usage()
    sys.exit(2)

try:
    sys.stdout.write(
        'Watson Relationship Extraction app. (Ctrl-z for terminating.)\n')

    # create classifiers with the training data
    relationship_extraction = RelationshipExtraction(
        username=reConstants.getUsername(), password=reConstants.getPassword())

    # set input encoding - change the encoding name according your platform
    sys.stdin = codecs.getreader('shift_jis')(sys.stdin)

    # loop for classify texts
    sys.stdout.write('Your input> ')
    for line in iter(sys.stdin.readline, ''):
        line = line.rstrip()
        if line != "":
            # send input message - encoding will be done in the SDK
            res = relationship_extraction.extract(line, sid, return_type)
            sys.stdout.write('Response: \n%s\n' % json.dumps(res, indent=2))

        sys.stdout.write('Your input> ')
import json
from watson_developer_cloud import RelationshipExtractionV1Beta

relationship_extraction = RelationshipExtractionV1Beta(
    username='******', password='******')

print(
    json.dumps(relationship_extraction.extract("Hello from IBM Watson",
                                               return_type='json'),
               indent=2))
Example #5
0
import json
from watson_developer_cloud import RelationshipExtractionV1Beta as RelationshipExtraction

relationship_extraction = RelationshipExtraction(
    username='******', password='******')

print(
    json.dumps(relationship_extraction.extract("Hello from IBM Watson",
                                               return_type='json'),
               indent=2))
# -*- coding: utf-8 -*-
"""
Created on Sat Nov 07 14:21:48 2015

@author: Camilo
"""
import time
from watson_developer_cloud import RelationshipExtractionV1Beta as RelationshipExtraction

username = '******'
password='******'
relationship_extraction = RelationshipExtraction(username = '******', 
                                                 password ='******')

print(relationship_extraction.extract("I would like to travel to dubai next week"))

try:
  while True:
      time.sleep(10000)
except KeyboardInterrupt:
  pass
Example #7
0
from watson_developer_cloud import RelationshipExtractionV1Beta as RelationshipExtraction

relationship_extraction = RelationshipExtraction(
    username='******', password='******')

print(relationship_extraction.extract("Hello from IBM Watson"))