def cmd_goto(ch, cmd, arg): '''Usage: goto <person | place | thing> Transfer yourself to a specified room, object, or person in game. Rooms are referenced by their zone key. ''' try: found, type = mud.parse_args(ch, True, cmd, arg, "{ room ch.world.noself }") except: return # what did we find? if type == "char": dest = found.room else: dest = found mud.message(ch, None, None, None, True, "to_room", "$n disappears in a puff of smoke.") ch.room = dest ch.act("look") mud.message(ch, None, None, None, True, "to_room", "$n appears in a puff of smoke.") hooks.run("enter", hooks.build_info("ch rm", (ch, ch.room)))
def cg_finish_handler(sock, arg): # pop our input handler for finishing character generation sock.pop_ih() # log that the character created mud.log_string("New player: " + sock.ch.name + " has entered the game.") # register and save him to disk and to an account mudsys.do_register(sock.ch) # make him exist in the game for functions to look him up mudsys.try_enter_game(sock.ch) # run the init_player hook hooks.run("init_player", hooks.build_info("ch", (sock.ch, ))) # attach him to his account and save the account sock.account.add_char(sock.ch) mudsys.do_save(sock.account) mudsys.do_save(sock.ch) # clear their screen sock.ch.act("clear") # send them the motd sock.ch.page(mud.get_motd()) # make him look at the room sock.ch.act("look") # run our enter hook hooks.run("enter", hooks.build_info("ch rm", (sock.ch, sock.ch.room)))
def acct_menu_handler(sock, arg): '''parses account commands (new character, enter game, quit, etc)''' if len(arg) == 0: return args = arg.split() args[0] = args[0].upper() if args[0].isdigit(): opts = sock.account.characters() arg = int(args[0]) if arg < 0 or arg >= len(opts): sock.send("Invalid choice!") else: acct_load_char(sock, opts[arg]) elif args[0] == 'L': if len(args) == 1: sock.send("Which character would you like to load?") else: acct_load_char(sock, args[1]) elif args[0] == 'Q' or "QUIT".startswith(args[0]): sock.send("Come back soon!") mudsys.do_save(sock.account) sock.close() elif args[0] == 'P': # sock.push_ih(acct_confirm_password_handler,acct_confirm_password_prompt) sock.push_ih(acct_new_password_handler, acct_new_password_prompt) sock.push_ih(acct_password_handler, acct_password_prompt) elif args[0] == 'N': if "player" in [x.strip() for x in mudsys.sys_getval("lockdown").split(",")]: sock.send("New characters are not allowed to be created at this time.") else: hooks.run("create_character", hooks.build_info("sk", (sock,))) else: sock.send("Invalid choice!")
def login_method_handler(sock, arg): args = arg.split() if len(args) == 0: return args[0] = args[0].lower() if "create".startswith(args[0]): if len(args) != 3: return elif mudsys.account_exists(args[1]): sock.send("{cAn account by that name already exists.{n\r\n") elif not check_acct_name(args[1]): txt = "{cThat is an invalid account name. Your account name must "\ "only consist of characters and numbers, and it must be " \ "4 and 12 characters in length. The first character MUST be "\ "a letter. Please pick another.{n" sock.send(mud.format_string(txt, False)) elif not try_create_account(sock, args[1], args[2]): sock.send("Your account was unable to be created.") elif "load".startswith(args[0]): if len(args) != 3: return elif not try_load_account(sock, args[1], args[2]): sock.send("{cInvalid account name or password.{n\r\n") elif "guest".startswith(args[0]): if (mudsys.sys_getval("lockdown") != '' and not utils.is_keyword(mudsys.sys_getval("lockdown"), "player")): sock.send("{cThe mud is currently locked out to new players.{n\r\n") else: sock.pop_ih() hooks.run("create_guest", hooks.build_info("sk", (sock,)))
def acct_load_char(sock, name): '''loads a character attached to the account. Argument supplied must be a name of the corresponding character''' chars = sock.account.characters() if not name.lower() in [n.lower() for n in sock.account.characters()]: sock.send("A character by that name does not exist on your account.") else: # first, try a reconnect ch = find_reconnect(name) # no reconnect? Try loading our character if not ch == None: # swap the sockets old_sock = ch.sock # attach and detach put in mudsys to prevent scripts from # messing around with the connections between chars and sockets mudsys.detach_char_socket(ch) mudsys.attach_char_socket(ch, sock) if old_sock != None: old_sock.close() mud.log_string(ch.name + " has reconnected.") # ch.act("clear") ch.send("You take over a body already in use.") ch.act("look") hooks.run("reconnect", hooks.build_info("ch", (ch, ))) sock.push_ih(mudsys.handle_cmd_input, mudsys.show_prompt, "playing") else: # load our character. Put in mudsys to prevent scripts from using it ch = mudsys.load_char(name) if ch == None: sock.send("The player file for " + name + " is missing.") elif (mudsys.sys_getval("lockdown") != '' and not ch.isInGroup(mudsys.sys_getval("lockdown"))): sock.send("You are currently locked out of the mud.") mud.extract(ch) else: # attach put in mudsys to prevent scripts from messing with # character and socket links mudsys.attach_char_socket(ch, sock) if mudsys.try_enter_game(ch): mud.log_string(ch.name + " has entered the game.") sock.push_ih(mudsys.handle_cmd_input, mudsys.show_prompt, "playing") # ch.act("clear") ch.page(mud.get_motd()) ch.act("look") hooks.run("enter", hooks.build_info("ch rm", (ch, ch.room))) else: sock.send("There was a problem entering the game. " + \ "try again later.") # detach put in mudsys t prevent scripts from messing with # character and socket links mudsys.detach_char_socket(ch, sock) mud.extract(ch)
def cg_finish_handler(sock, arg): # pop our input handler for finishing character generation sock.pop_ih() # log that the character created mud.log_string("New player: " + sock.ch.name + " has entered the game.") # register and save him to disk and to an account mudsys.do_register(sock.ch) # make him exist in the game for functions to look him up mudsys.try_enter_game(sock.ch) # run the init_player hook hooks.run("init_player", hooks.build_info("ch", (sock.ch,))) # attach him to his account and save the account sock.account.add_char(sock.ch) mudsys.do_save(sock.account) mudsys.do_save(sock.ch) # clear their screen sock.ch.act("clear") # send them the motd sock.ch.page(mud.get_motd()) # make him look at the room sock.ch.act("look") # run our enter hook hooks.run("enter", hooks.build_info("ch rm", (sock.ch, sock.ch.room)))
def acct_load_char(sock, name): '''loads a character attached to the account. Argument supplied must be a name of the corresponding character''' chars = sock.account.characters() if not name.lower() in [n.lower() for n in sock.account.characters()]: sock.send("A character by that name does not exist on your account.") else: # first, try a reconnect ch = find_reconnect(name) # no reconnect? Try loading our character if not ch == None: # swap the sockets old_sock = ch.sock # attach and detach put in mudsys to prevent scripts from # messing around with the connections between chars and sockets mudsys.detach_char_socket(ch) mudsys.attach_char_socket(ch, sock) if old_sock != None: old_sock.close() mud.log_string(ch.name + " has reconnected.") # ch.act("clear") ch.send("You take over a body already in use.") ch.act("look") hooks.run("reconnect", hooks.build_info("ch", (ch,))) sock.push_ih(mudsys.handle_cmd_input, mudsys.show_prompt, "playing") else: # load our character. Put in mudsys to prevent scripts from using it ch = mudsys.load_char(name) if ch == None: sock.send("The player file for " + name + " is missing.") elif (mudsys.sys_getval("lockdown") != '' and not ch.isInGroup(mudsys.sys_getval("lockdown"))): sock.send("You are currently locked out of the mud.") mud.extract(ch) else: # attach put in mudsys to prevent scripts from messing with # character and socket links mudsys.attach_char_socket(ch, sock) if mudsys.try_enter_game(ch): mud.log_string(ch.name + " has entered the game.") sock.push_ih(mudsys.handle_cmd_input, mudsys.show_prompt, "playing") # ch.act("clear") ch.page(mud.get_motd()) ch.act("look") hooks.run("enter", hooks.build_info("ch rm", (ch, ch.room))) else: sock.send("There was a problem entering the game. " + \ "try again later.") # detach put in mudsys t prevent scripts from messing with # character and socket links mudsys.detach_char_socket(ch, sock) mud.extract(ch)
def do_drop(ch, obj): '''handles object dropping''' obj.room = ch.room mud.message(ch, None, obj, None, True, "to_char", "You drop $o.") mud.message(ch, None, obj, None, True, "to_room", "$n drops $o.") # run our drop hook hooks.run("drop", hooks.build_info("ch obj", (ch, obj)))
def do_give(ch, recv, obj): '''does the handling of the give command''' mud.message(ch, recv, obj, None, True, "to_room", "$n gives $o to $N.") mud.message(ch, recv, obj, None, True, "to_vict", "$n gives $o to you.") mud.message(ch, recv, obj, None, True, "to_char", "You give $o to $N.") obj.carrier = recv # run our give hook hooks.run("give", hooks.build_info("ch ch obj", (ch, recv, obj)))
def do_wear(ch, obj, where): '''handles object wearing''' if not obj.istype("worn"): ch.send("But " + ch.see_as(obj) + " is not equippable.") elif ch.equip(obj, where): mud.message(ch, None, obj, None, True, "to_char", "You wear $o.") mud.message(ch, None, obj, None, True, "to_room", "$n wears $o.") # run our wear hook hooks.run("wear", hooks.build_info("ch obj", (ch, obj)))
def do_remove(ch, obj): '''handles equipment removing''' # try to put it to our inventory obj.carrier = ch # make sure it succeeded if obj.carrier != ch: ch.send("You were unable to remove " + ch.see_as(obj) + ".") else: mud.message(ch, None, obj, None, True, "to_char", "You remove $o.") mud.message(ch, None, obj, None, True, "to_room", "$n removes $o.") # run our hooks hooks.run("remove", hooks.build_info("ch obj", (ch, obj)))
def cmd_open(ch, cmd, arg): '''Usage: open [the] <direction | door | container> Attempts to open the speficied door, direction, or container.''' try: found, type = mud.parse_args(ch, True, cmd, arg, "[the] {obj.room.inv exit }") except: return # is it an exit? if type == "exit": ex = found name = ex.name if name == "": name = "the exit" if not ex.is_closed: ch.send(name + " is already open.") elif ex.is_locked: ch.send(name + " must be unlocked first.") elif not ex.is_closable: ch.send(name + " cannot be opened.") else: mud.message(ch, None, None, None, True, "to_char", "You open " + name + ".") mud.message(ch, None, None, None, True, "to_room", "$n opens " + name + ".") ex.open() # hooks.run("room_change", hooks.build_info("rm", (ch.room, ))) try_manip_other_exit(ch.room, ex, False, ex.is_locked) hooks.run("open_door", hooks.build_info("ch ex", (ch, ex))) # must be an object else: obj = found if not obj.istype("container"): ch.send(ch.see_as(obj) + " is not a container.") elif not obj.container_is_closed: ch.send(ch.see_as(obj) + " is already open.") elif obj.container_is_locked: ch.send(ch.see_as(obj) + " must be unlocked first.") elif not obj.container_is_closable: ch.send(ch.see_as(obj) + " cannot be opened.") else: mud.message(ch, None, obj, None, True, "to_char", "You open $o.") mud.message(ch, None, obj, None, True, "to_room", "$n opens $o.") obj.container_is_closed = False hooks.run("open_obj", hooks.build_info("ch obj", (ch, obj)))
def do_get(ch, obj, cont): '''transfers an item from the ground to the character''' if utils.is_keyword(obj.bits, "notake"): ch.send("You cannot take " + ch.see_as(obj) + ".") elif cont != None: obj.carrier = ch mud.message(ch, None, obj, cont, True, "to_char", "You get $o from $O.") mud.message(ch, None, obj, cont, True, "to_room", "$n gets $o from $O.") else: obj.carrier = ch mud.message(ch, None, obj, None, True, "to_char", "You get $o.") mud.message(ch, None, obj, None, True, "to_room", "$n gets $o.") # run get hooks hooks.run("get", hooks.build_info("ch obj", (ch, obj)))
def cmd_say(ch, cmd, arg): '''Usage: say <message> This command will send a message to everyone in the same room as you. Say, like ask, can trigger NPC dialogs.''' if arg == '': ch.send("Say what?") else: arg = arg.replace("$", "$$") mud.message(ch, None, None, None, False, "to_room", "{y$n says, '" + arg + "'{n") mud.message(ch, None, None, None, False, "to_char", "{yyou say, '" + arg + "'{n") # run say hooks hooks.run("say", hooks.build_info("ch str", (ch, arg)))
def cmd_greet(ch, cmd, arg): '''Usage: greet <person> NPCs with dialogs will often have something to say when you greet or approach then. Greeting an NPC is a way to get them talking.''' try: tgt, = mud.parse_args(ch, True, cmd, arg, "ch.room.noself") except: return mud.message(ch, tgt, None, None, False, "to_char", "You greet $N.") mud.message(ch, tgt, None, None, False, "to_vict", "$n greets you.") mud.message(ch, tgt, None, None, False, "to_room", "$n greets $N.") # run greet hooks hooks.run("greet", hooks.build_info("ch ch", (ch, tgt))) hooks.run("post_greet", hooks.build_info("ch ch", (ch, tgt)))
def cmd_open(ch, cmd, arg): '''Usage: open [the] <direction | door | container> Attempts to open the speficied door, direction, or container.''' try: found,type=mud.parse_args(ch,True,cmd,arg, "[the] {obj.room.inv exit }") except: return # is it an exit? if type == "exit": ex = found name = ex.name if name == "": name = "the exit" if not ex.is_closed: ch.send(name + " is already open.") elif ex.is_locked: ch.send(name + " must be unlocked first.") elif not ex.is_closable: ch.send(name + " cannot be opened.") else: mud.message(ch, None, None, None, True, "to_char", "You open " + name + ".") mud.message(ch, None, None, None, True, "to_room", "$n opens " + name + ".") ex.open() # hooks.run("room_change", hooks.build_info("rm", (ch.room, ))) try_manip_other_exit(ch.room, ex, False, ex.is_locked) hooks.run("open_door", hooks.build_info("ch ex", (ch, ex))) # must be an object else: obj = found if not obj.istype("container"): ch.send(ch.see_as(obj) + " is not a container.") elif not obj.container_is_closed: ch.send(ch.see_as(obj) + " is already open.") elif obj.container_is_locked: ch.send(ch.see_as(obj) + " must be unlocked first.") elif not obj.container_is_closable: ch.send(ch.see_as(obj) + " cannot be opened.") else: mud.message(ch, None, obj, None, True, "to_char", "You open $o.") mud.message(ch, None, obj, None, True, "to_room", "$n opens $o.") obj.container_is_closed = False hooks.run("open_obj", hooks.build_info("ch obj", (ch, obj)))
def cmd_tell(ch, cmd, arg): '''Usage: tell <person> <message> This command sends a message to another character. Primarily intended for player-to-player communication. Players can tell other players things even if they are not in the same room. see also: reply''' try: tgt, mssg = mud.parse_args(ch, True, cmd, arg, "ch.world.noself string(message)") except: return mssg = mssg.replace("$", "$$") tovict = "{r$n tells you, '" + mssg + "'{n" toch = "{rYou tell $N, '" + mssg + "'{n" mud.message(ch, tgt, None, None, False, "to_vict", tovict) mud.message(ch, tgt, None, None, False, "to_char", toch) history.add_history(ch, "tell", "{r%-10s: %s{n" % (ch.name, mssg)) history.add_history(tgt, "tell", "{r%-10s: %s{n" % (ch.name, mssg)) hooks.run("tell", hooks.build_info("ch ch str", (ch, tgt, mssg)))
def cmd_ask(ch, cmd, arg): '''Usage: ask <person> [about] <question> This command is used to pose a question to another character. Mostly, this is intended to be used to carry on dialogs with NPCs. Ask has a local range (i.e. you can only ask questions to people in the same room as you. ''' try: tgt, question =mud.parse_args(ch, True, cmd, arg, "ch.room.noself [about] string(question)") except: return question = question.replace("$", "$$") mud.message(ch, tgt, None, None, False, "to_vict", "{w$n asks you, '" + question + "'{n") mud.message(ch, tgt, None, None, False, "to_char", "{wYou ask $N, '" + question + "'{n") # run our ask hooks hooks.run("ask", hooks.build_info("ch ch str", (ch, tgt, question)))
def guest_gen_hook(info): sock, = hooks.parse_info(info) sock.push_ih(mudsys.handle_cmd_input, mudsys.show_prompt, "playing") # make the guest character ch = mudsys.create_player("Guest") # oops... if ch == None: sock.send("Sorry, there were issues creating a guest account.") sock.close() mudsys.attach_char_socket(ch, sock) ch.rdesc = "a guest player is here, exploring the world." ch.name = ch.name + str(ch.uid) ch.race = "human" # log that the character created mud.log_string("Guest character created (id %d)." % ch.uid) # make him exist in the game for functions to look him up mudsys.try_enter_game(ch) # run the init_player hook hooks.run("init_player", hooks.build_info("ch", (ch,))) # clear our screen ch.act("clear") # send them the motd ch.page(mud.get_motd()) # make him look at the room ch.act("look") # run our enter hook hooks.run("enter", hooks.build_info("ch rm", (ch, ch.room)))
def guest_gen_hook(info): sock, = hooks.parse_info(info) sock.push_ih(mudsys.handle_cmd_input, mudsys.show_prompt, "playing") # make the guest character ch = mudsys.create_player("Guest") # oops... if ch == None: sock.send("Sorry, there were issues creating a guest account.") sock.close() mudsys.attach_char_socket(ch, sock) ch.rdesc = "a guest player is here, exploring the world." ch.name = ch.name + str(ch.uid) ch.race = "human" # log that the character created mud.log_string("Guest character created (id %d)." % ch.uid) # make him exist in the game for functions to look him up mudsys.try_enter_game(ch) # run the init_player hook hooks.run("init_player", hooks.build_info("ch", (ch, ))) # clear our screen ch.act("clear") # send them the motd ch.page(mud.get_motd()) # make him look at the room ch.act("look") # run our enter hook hooks.run("enter", hooks.build_info("ch rm", (ch, ch.room)))
long_description = f.readlines() try: libdispatcheraccess = os.environ['LIBDISPATCHERACCESS'] except KeyError: libdispatcheraccess = os.path.join( os.path.dirname(os.path.abspath(__file__)), 'lib') qtpath = os.environ.get('QTPATH', '/usr/include/qt5') if not os.path.exists(qtpath): if find_executable('pkg-config') is None: raise RuntimeError( 'Either set the environment variable QTPATH to the Qt5 root includ' 'e directory or install the pkg-config utility.') try: out = hooks.run( 'pkg-config Qt5Core Qt5Network Qt5Widgets --cflags-only-I') except RuntimeError: raise RuntimeError('The Qt5 include directories could not be found.') qt_include = out[2:].split(' -I') else: qt_include = [ os.path.join(qtpath, _) for _ in ('', 'QtCore', 'QtNetwork', 'QtWidgets') ] include_dirs = ['include', 'src'] + qt_include libraries = [ 'dispatcheraccess', 'dispatchertf', 'Qt5Core', 'Qt5Gui', ('helpers', { 'language': 'c++',
def try_move(ch, dir, mssg = False): '''Handles all moving of characters from one room to another, through commands. Attempts a move. If successful, returns the exit left through.''' ex = ch.room.exit(dir) success = False exname = "it" if ex != None and ex.name != "": exname = ex.name # did we find an exit? if ex == None or not ch.cansee(ex): if not ch.isInGroup("builder"): ch.send("Alas, there is no exit in that direction.") elif ex != None and not ch.cansee(ex): ch.send("There is an exit, but you can't see it.") ch.send("Turn on your wizard lense!") else: hooks.run("try_buildwalk", hooks.build_info("ch str", (ch, dir))) elif ex.is_closed: ch.send("You will have to open " + exname + " first.") elif ex.dest == None: ch.send("It doesn't look like " + exname + " leads anywhere!") else: old_room = ch.room dirnum = dir_index(dir) # send out our leave mud.messages as needed. Is anyone in the old room? if mssg == True: if ex.leave_mssg != '': mud.message(ch, None, None, None, True, "to_room",ex.leave_mssg) elif dirnum == -1: mud.message(ch, None, None, None, True, "to_room", "$n leaves.") else: mud.message(ch, None, None, None, True, "to_room", "$n leaves " + dir_name[dirnum] + ".") # run our leave hooks hooks.run("exit", hooks.build_info("ch rm ex", (ch, ch.room, ex))) # if a hook hasn't moved us, go through with going through the exit if ch.room == old_room: ch.room = ex.dest # stuff that happens before we 'look' hooks.run("pre_enter", hooks.build_info("ch rm", (ch, ch.room))) ch.act("look") # send out our enter mud.messages as needed if mssg == True: if ex.enter_mssg != '': mud.message(ch,None,None,None,True,"to_room",ex.enter_mssg) elif dirnum == -1: mud.message(ch,None,None,None,True,"to_room","$n has arrived.") else: mud.message(ch, None, None, None, True, "to_room", "$n arrives from the "+dir_name[dir_opp[dirnum]]+".") # run our enter hooks hooks.run("enter", hooks.build_info("ch rm", (ch, ch.room))) success = True # return the exit we found (if we found any) return ex, success
def try_move(ch, dir, mssg=False): '''Handles all moving of characters from one room to another, through commands. Attempts a move. If successful, returns the exit left through.''' ex = ch.room.exit(dir) success = False exname = "it" if ex != None and ex.name != "": exname = ex.name # did we find an exit? if ex == None or not ch.cansee(ex): ch.send("Alas, there is no exit in that direction.") elif ex.is_closed: ch.send("You will have to open " + exname + " first.") elif ex.dest == None: ch.send("It doesn't look like " + exname + " leads anywhere!") else: old_room = ch.room dirnum = dir_index(dir) # send out our leave mud.messages as needed. Is anyone in the old room? if mssg == True: if ex.leave_mssg != '': mud.message(ch, None, None, None, True, "to_room", ex.leave_mssg) elif dirnum == -1: mud.message(ch, None, None, None, True, "to_room", "$n leaves.") else: mud.message(ch, None, None, None, True, "to_room", "$n leaves " + dir_name[dirnum] + ".") # run our leave hooks hooks.run("exit", hooks.build_info("ch rm ex", (ch, ch.room, ex))) # if a hook hasn't moved us, go through with going through the exit if ch.room == old_room: ch.room = ex.dest # stuff that happens before we 'look' hooks.run("pre_enter", hooks.build_info("ch rm", (ch, ch.room))) ch.act("look") # send out our enter mud.messages as needed if mssg == True: if ex.enter_mssg != '': mud.message(ch, None, None, None, True, "to_room", ex.enter_mssg) elif dirnum == -1: mud.message(ch, None, None, None, True, "to_room", "$n has arrived.") else: mud.message( ch, None, None, None, True, "to_room", "$n arrives from the " + dir_name[dir_opp[dirnum]] + ".") # run our enter hooks hooks.run("enter", hooks.build_info("ch rm", (ch, ch.room))) success = True # return the exit we found (if we found any) return ex, success
def nextSubgraph(self): token = self.buffer.peek() word_pos = token.word + "_" + token.pos lemma_pos = token.lemma + "_" + token.pos #TRICK FOR SEMICOLONS if token.word == ";": if self.semicol_gen_and: return Subgraph([],[]) else: self.semicol_gen_and = True return Subgraph([Node(token, self.variables.nextVar(), "and", False)],[]) #HOOKS if self.hooks and token.ne != "O" and (token.ne == "ORGANIZATION" and word_pos in Resources.phrasetable) == False: ret = hooks.run(token, token.word, token.ne, self.variables) if ret != False: return Subgraph(ret[0],ret[1]) #ISI LISTS # if token.word in Resources.verbalization_list: # return Resources.verbalization_list[token.word].get(token, self.variables) # if token.lemma in Resources.verbalization_list: # return Resources.verbalization_list[token.lemma].get(token, self.variables) #PHRASETABLE if word_pos in Resources.phrasetable: return Resources.phrasetable[word_pos].get(token, self.variables) if lemma_pos in Resources.phrasetable: return Resources.phrasetable[lemma_pos].get(token, self.variables) #UNKNOWN TOKENS (variables or constants) if token.ne == "O": #var v = self.variables.nextVar() label = "" if token.pos.startswith("V"): label = token.lemma.replace('"','') if label == "": label = "emptyconcept" label += "-01" if label == "": label = token.lemma if label == "": label = token.word if label.count('"') % 2 != 0: label = "".join(label.rsplit('"', 1)) if label.count("'") % 2 != 0: label = "".join(label.rsplit("'", 1)) label = label.replace('""','"') if "_" in label or "\\" in label or ":" in label or "/" in label or "(" in label or ")" in label: label = "genericconcept" if label == "": label = "emptyconcept" if label.startswith("@"): label = label[1:] label = label.lower() return Subgraph([Node(token, v, label, False)],[]) #UNKNKOWN CONSTANTS nodes = [] token.word = re.sub("[-\/\\\/\(\)]","_",token.word) for t in token.word.split("_"): if t.replace(".","").isdigit() and t != '""': nodes.append(Node(token, t, token.ne, True)) elif t != "": nodes.append(Node(token, '"' + t + '"', token.ne, True)) return Subgraph(nodes,[])