IBM / build-knowledge-base-with-domain-specific-documents

Create a knowledge base using domain specific documents and the mammoth python library
https://developer.ibm.com/patterns/build-a-domain-specific-knowledge-graph-from-given-set-of-documents/
Apache License 2.0
130 stars 43 forks source link

Run for help #8

Open LMY-nlp0701 opened 5 years ago

LMY-nlp0701 commented 5 years ago

Hi,@Neha-Setia I have some questions and i hope you can answer.

1. I use Jupyter notebook directly to run your code which you provide rather than running using a Jupyter notebook in the IBM Watson Studio. So,Is there any problem?

2. I think I have successfully installed all the environments.

install_1 install_2 install_3

It is worth noting that Version of watson-developer-cloud is not ==1.5, Because I install this version will prompt errors.

3. So here comes the question:

3.1 What's the meaning of following?

 #Add credentials of config_classification.txt here
 #Insert the authentication credentials as credentials_2 

&

Add credentials of config__relations.txt here

 #Insert the authentication credentials as credentials_3 

And, What do I need to do?

3.2 There is an error in running the next code.

configure object storage client


ValueError Traceback (most recent call last)

in () 4 ibm_auth_endpoint=credentials_1['IBM_AUTH_ENDPOINT'], 5 config=Config(signature_version='oauth'), ----> 6 endpoint_url=credentials_1['ENDPOINT']) 7 8 def get_file(filename): ~\Anaconda3\lib\site-packages\ibm_boto3\__init__.py in client(*args, **kwargs) 81 See :py:meth:`boto3.session.Session.client`. 82 """ ---> 83 return _get_default_session().client(*args, **kwargs) 84 85 ~\Anaconda3\lib\site-packages\ibm_boto3\session.py in client(self, service_name, region_name, api_version, use_ssl, verify, endpoint_url, aws_access_key_id, aws_secret_access_key, aws_session_token, ibm_api_key_id, ibm_service_instance_id, ibm_auth_endpoint, auth_function, token_manager, config) 322 ibm_api_key_id=ibm_api_key_id, ibm_service_instance_id=ibm_service_instance_id, 323 ibm_auth_endpoint=ibm_auth_endpoint, auth_function=auth_function, --> 324 token_manager=token_manager, config=config) 325 326 def resource(self, service_name, region_name=None, api_version=None, ~\Anaconda3\lib\site-packages\ibm_botocore\session.py in create_client(self, service_name, region_name, api_version, use_ssl, verify, endpoint_url, aws_access_key_id, aws_secret_access_key, aws_session_token, ibm_api_key_id, ibm_service_instance_id, ibm_auth_endpoint, auth_function, token_manager, config) 910 is_secure=use_ssl, endpoint_url=endpoint_url, verify=verify, 911 credentials=credentials, scoped_config=self.get_scoped_config(), --> 912 client_config=config, api_version=api_version) 913 914 # Register custom callbacks ~\Anaconda3\lib\site-packages\ibm_botocore\client.py in create_client(self, service_name, region_name, is_secure, endpoint_url, verify, credentials, scoped_config, api_version, client_config) 68 client_args = self._get_client_args( 69 service_model, region_name, is_secure, endpoint_url, ---> 70 verify, credentials, scoped_config, client_config, endpoint_bridge) 71 service_client = cls(**client_args) 72 self._register_retries(service_client) ~\Anaconda3\lib\site-packages\ibm_botocore\client.py in _get_client_args(self, service_model, region_name, is_secure, endpoint_url, verify, credentials, scoped_config, client_config, endpoint_bridge) 224 return args_creator.get_client_args( 225 service_model, region_name, is_secure, endpoint_url, --> 226 verify, credentials, scoped_config, client_config, endpoint_bridge) 227 228 def _create_methods(self, service_model): ~\Anaconda3\lib\site-packages\ibm_botocore\args.py in get_client_args(self, service_model, region_name, is_secure, endpoint_url, verify, credentials, scoped_config, client_config, endpoint_bridge) 69 response_parser_factory=self._response_parser_factory, 70 max_pool_connections=new_config.max_pool_connections, ---> 71 timeout=(new_config.connect_timeout, new_config.read_timeout)) 72 73 serializer = ibm_botocore.serialize.create_serializer( ~\Anaconda3\lib\site-packages\ibm_botocore\endpoint.py in create_endpoint(self, service_model, region_name, endpoint_url, verify, response_parser_factory, timeout, max_pool_connections) 270 if not is_valid_endpoint_url(endpoint_url): 271 --> 272 raise ValueError("Invalid endpoint: %s" % endpoint_url) 273 return Endpoint( 274 endpoint_url, ValueError: Invalid endpoint:
Neha-Setia commented 5 years ago

Hi @LMY-nlp0701! The instructions to run the notebook in the Watson studio are given in the documentation readme.md file. I recommend you the run the notebook on the cloud. And also, if you want to run the notebook locally. Remove the credentials cell and import the config_classification.txt and config_relation.txt locally from your system. You can download these files under the folder data.

LMY-nlp0701 commented 5 years ago

Hi,@Neha-Setia I only want to run the notebook locally. I followed your advice and The following modifications have been made.

1. I did not use cloud services, so I commented off the relevant code.

commented off_1 commented off_2

2. Local Importing of related files

file directory

2.1 Import .docx docx

2.2 Import the config_classification.txt and config_relation.txt txt

3. Problem and Question

3.1 Do I need to register Natural Language Understanding? login

3.2 Error: Unauthorized: Access is denied due to invalid credentials , Code: 401 error

There is only one step away from success.Thank you!

Neha-Setia commented 5 years ago

@LMY-nlp0701 hey yes yes you need to register Natural Language Understanding on IBM Cloud.

LMY-nlp0701 commented 5 years ago

Hi,@Neha-Setia Because I had something to do last week, so I didn't go on with this work. Today, I go on with this work.

1. Register Natural Language Understanding on IBM Cloud.

I think I have successfully registered. The pictures of registering are as follows: ibm_cloud_register

Note: I hope you can check that I registered correctly, and then I chose the free version. Must I choose the paid version?

2. New Error

I completed my username and password on jupyter, but I still encountered some new mistakes. The pictures of filling in are as follows: login_nlu

The pictures of error are as follows: error

TypeError: 'DetailedResponse' object is not subscriptable

I'm sorry to trouble you, but I hope you can solve it for me. Thank you !

Prashant62S commented 5 years ago

Screenshot from 2019-05-04 23-01-17 Screenshot from 2019-05-04 23-01-34 Screenshot from 2019-05-04 23-01-46

Prashant62S commented 5 years ago

in 3rd image in first column what i have to write in username and password..i want to use jupyter notebook globally..i dont want to use ibm cloud service.please hepl me.itz urgent.

Neha-Setia commented 5 years ago

@Prashant62S you can use the free version of Natural Language classifier. Under the credentials, you can use API key in the code. There may be the possibility, you have exhausted the free version on this id. I can support it end to end if you are using IBM cloud services in the code pattern, else I won't be able to help you as it's beyond my capability.

ghost commented 4 years ago

@Prashant62S did you manage to solve your issue? I ran into the same problem and solved it the following way: IBM cloud services recently changed the way the handle credentials. Simply use your "service credentials". It will look like this: natural_language_understanding = NaturalLanguageUnderstandingV1( username= 'apikey', password='DZ7Txxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', url = "https://gateway-lon.watsonplatform.net/natural-language-understanding/api", version='2017-02-27')