Commit 8f156139 authored by ajil.k's avatar ajil.k

added

parents
# Default ignored files
/shelf/
/workspace.xml
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="PyPep8Inspection" enabled="true" level="WEAK WARNING" enabled_by_default="true">
<option name="ignoredErrors">
<list>
<option value="E712" />
</list>
</option>
</inspection_tool>
<inspection_tool class="PyPep8NamingInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true">
<option name="ignoredErrors">
<list>
<option value="N801" />
</list>
</option>
</inspection_tool>
<inspection_tool class="PyUnresolvedReferencesInspection" enabled="true" level="WARNING" enabled_by_default="true">
<option name="ignoredIdentifiers">
<list>
<option value="dict.mobile" />
<option value="dict.dob" />
<option value="dict.gender" />
<option value="dict.name" />
</list>
</option>
</inspection_tool>
</profile>
</component>
\ No newline at end of file
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.9 (text_to_speech)" project-jdk-type="Python SDK" />
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/text_to_speech.iml" filepath="$PROJECT_DIR$/.idea/text_to_speech.iml" />
</modules>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/venv" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
\ No newline at end of file
import copy
class Character:
def __init__(self, name, health, speed, damage, skills):
self.name = name
self.health = health
self.speed = speed
self.damage = damage
self.skills = skills
def __str__(self):
# Returns
return f"{self.name} (health: {self.health}, speed: {self.speed}, damage: {self.damage}, skills: {self.skills})"
class CharacterPrototype:
def __init__(self):
self.character = {}
# Method for creating new character
def create_character(self, name, character):
self.character[name] = character
# Method for cloning the base character and update its attributes
def clone(self, name, **attrs):
character = copy.deepcopy(self.character.get(name))
character.__dict__.update(attrs)
return character
# Creates a prototype for a base character
base_character = Character("Character", health=100, speed=5, damage=10, skills=12)
# Creates a prototype object and register the base character
prototype = CharacterPrototype()
prototype.create_character("normal_character", base_character)
# Creates a new character by cloning the base character and updating its attributes
four_star_character = prototype.clone("normal_character", speed=25, damage=25)
five_star_character = prototype.clone("normal_character", health=125, speed=30, damage=50)
# Printing the characters
print("Normal Character attribute:\n", base_character)
print("4 STAR Character attribute:\n", four_star_character)
print("5 STAR Character attribute:\n", five_star_character)
import pyttsx3
# initialize the engine
engine = pyttsx3.init()
# set the voice
voices = engine.getProperty('voices')
engine.setProperty('voice', voices[1].id)
# say the text
engine.say("Let's Enjoy the moment.")
# run the engine
engine.runAndWait()
# from gtts import gTTS
# import os
#
# # Specify the Malayalam text to be spoken
# text = "ഷിബിലി നീ എന്ത് ചെയ്യുന്നു"
#
# # Create a gTTS object and specify the language as Malayalam
# tts = gTTS(text=text, lang='ml')
#
# # Save the audio as mp3 file
# tts.save("malayalam_audio.mp3")
#
#
# # Use the default media player to play the audio file
# os.system("start malayalam_audio.mp3")
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment