Exemple #1
0
    def __init__(self):
        self.possessions = set([])
        self.gold = 10
        self.profession = None

        self.traits = {}

        self.knowledge = infinite_defaultdict()
        self.knowledge['objects'][GOAL_ITEM]['location']['accuracy'] = 2
Exemple #2
0
    def __init__(self):
        self.possessions = set([])
        self.gold = 10
        self.profession = None

        self.traits = {}

        self.knowledge = infinite_defaultdict()
        self.knowledge['objects'][GOAL_ITEM]['location']['accuracy'] = 2
Exemple #3
0
    def __init__(self,
                 name,
                 layers,
                 sharp,
                 tags,
                 attachment_info,
                 position=None,
                 wearing_info=None):
        self.name = name
        # Owner should be overwritten when object initializes
        self.owner = None

        ## Add layers
        self.layers = []
        for layer in layers:
            self.add_material_layer(layer,
                                    layer_is_inherent_to_object_component=True)

        self.sharp = sharp
        # The sharpness will get worn down, so this keeps track of how we can repair it
        self.maxsharp = sharp

        # Stuff attached to us
        self.attachments = []
        ## attachment_info should be (name_of_other_part, attach_strength)
        self.attachment_info = attachment_info
        self.attached_to = None
        self.attach_strength = None

        self.position = position
        ## Convoluted code to help with clothing/wearing
        if wearing_info:
            self.bodypart_covered = wearing_info[0]
            self.bodypart_attached = wearing_info[1]
            self.bodypart_attach_strength = wearing_info[2]
        else:
            self.bodypart_covered = None
            self.bodypart_attached = None
            self.bodypart_attach_strength = None
        ###############################################

        # Any text written or engraved on the component
        self.text = defaultdict(list)
        # Any text that carries some written or engraved information on the component
        self.information = infinite_defaultdict()

        self.storage = None
        ## tags, such as attaching, holding, or grasping
        self.tags = tags
        if 'storage' in self.tags:
            self.storage = []

        self.grasped_item = None
Exemple #4
0
    def __init__(self, name, layers, sharp, tags, attachment_info, position=None, wearing_info=None):
        self.name = name
        # Owner should be overwritten when object initializes
        self.owner = None

        ## Add layers
        self.layers = []
        for layer in layers:
            self.add_material_layer(layer, layer_is_inherent_to_object_component=True)

        self.sharp = sharp
        # The sharpness will get worn down, so this keeps track of how we can repair it
        self.maxsharp = sharp

        # Stuff attached to us
        self.attachments = []
        ## attachment_info should be (name_of_other_part, attach_strength)
        self.attachment_info = attachment_info
        self.attached_to = None
        self.attach_strength = None

        self.position = position
        ## Convoluted code to help with clothing/wearing
        if wearing_info:
            self.bodypart_covered = wearing_info[0]
            self.bodypart_attached = wearing_info[1]
            self.bodypart_attach_strength = wearing_info[2]
        else:
            self.bodypart_covered = None
            self.bodypart_attached = None
            self.bodypart_attach_strength = None
        ###############################################

        # Any text written or engraved on the component
        self.text = defaultdict(list)
        # Any text that carries some written or engraved information on the component
        self.information = infinite_defaultdict()

        self.storage = None
        ## tags, such as attaching, holding, or grasping
        self.tags = tags
        if 'storage' in self.tags:
            self.storage = []

        self.grasped_item = None
Exemple #5
0
        for query_cat in query_sets:
            configs.append({
                'device_name': device_name,
                'search_engine': search_engine,
                'query_cat': query_cat,
            })

#%%
# ## "What queries were made?"
print('Queries made and how many SERPs per query:')
print(full_df.target.value_counts().sort_index())

#%%
# we will have one dataframe full of links for each combination of device_name / search_engine / query_cat
# in each df, each row corresponds to a single <a> link element
dfs = infinite_defaultdict()
# this three-key dict will be use the following sequence of keys: device_name, search_engine, query_cat
errs = []
for config in configs:
    device_name = config['device_name']
    search_engine = config['search_engine']
    query_cat = config['query_cat']
    sub = full_df[(full_df.deviceName == device_name)
                  & (full_df.platform == search_engine) &
                  (full_df.queryCat == query_cat)]
    links_rows = []
    print(device_name, search_engine, query_cat)
    for i, row in sub.iterrows():
        linkElements = row.linkElements
        #print(row)
        try: