Melissa-AI / Melissa-Core

A lovely virtual assistant for OS X, Windows and Linux systems.
MIT License
490 stars 201 forks source link

Refactoring to Python 3 and Object Oriented Design #194

Closed tanay1337 closed 4 years ago

tanay1337 commented 6 years ago

The codebase needs to be updated to Python 3 along with the implementation of Object Oriented Design.

bhaveshAn commented 6 years ago

@emedvedev For the Object Oriented Design part. Could you please discuss the approach you will work for this because I have some other alternative here. https://github.com/kivy/plyer in this project first some facade/example is made having classname and methods ex. class TTS and method def speak(self) which initially set to NotImplementedError to implement feature concerning it. And then we make different implementations concerning each platform like

  1. Windows : in win dir we create tts.py and inherits TTS class with overriding speak method with corresponding implementation for windows. Similarly, linux dir for linux and tts.py inheriting TTS class again with its implementation.

If looks good then would like to work on it as I have already contributing to that project.

Thanks !!

emedvedev commented 6 years ago

@bhaveshAn sounds good to me. Here's what you can do:

You're welcome to work on it. Later we'll use a similar approach for actions, too.

bhaveshAn commented 6 years ago

@emedvedev

Create a structure as you have proposed, i.e. tts/ engine /main.py

From engine do you mean espeak / say Like to create tts/espeak/main.py and tts/say/main.py Or please elaborate if I am getting wrong.

emedvedev commented 6 years ago

Yes, you're getting it right. :)

bhaveshAn commented 6 years ago

@emedvedev I have to make a PR in WIP. Since there is huge change in codebase, so will it be good to make a new branch in upstream say py3 so that it may not affect current codebase which is on py2

What say.

emedvedev commented 6 years ago

Yup, a new branch sounds nice.

bhaveshAn commented 6 years ago

Could you make one?

emedvedev commented 6 years ago

Done, you can make PRs against the py3 branch now.

idanwekhai commented 6 years ago

I would like to work on this

emedvedev commented 6 years ago

Bhavesh is running point on this one, and you're more than welcome to coordinate with him and see if you can somehow split the task.

bhaveshAn commented 6 years ago

@emedvedev For OOD, we have made objects for tts as config.py tts_engine = SayTTS() or tts_engine = EspeakTTS() # depending on platform

Earlier, we are using WORDS const Example: WORDS = {'news_reader': {'groups': [['business', 'news']]}} for business_news_reader module. But for actions it would better to switch to NLP instead of WORDS const as mentioned earlier.

Like,

business_news = BusinessNewsReader()
user_query = 'something asking to melissa'
if 'business' in nltk.tokenize.word_tokenize(user_query) and 'news' in nltk.tokenizeword_tokenize(user_query):
    business_news.news_reader(user_query)

etc for other action modules.

What say.

emedvedev commented 6 years ago

Please open a PR for every separate feature, and once there's code, I'll be happy to comment on it.

NLP is definitely outside of the scope of this issue though. We are refactoring the existing code first, so let's stick to that.

bhaveshAn commented 6 years ago

For the part of Refactoring to Python 3 I tried to install deps for python3 locally from requirements.txt

  1. only poster==0.8.1 was not been processed as it only supports py2 as of now. While all the other deps were installed properly.
  2. every print "text" syntax is required to change to print()
anantvir commented 5 years ago

Can I work on this if its still pending ?