整两句:找个地方放下长不长短不短的瞎想

有时候会有些正儿八经, 长不长短不短的瞎想, 还是总得找个地方放一放, 最近就是因为统计这破专业原因想得大半夜都没能睡着, 所以放这里好了, 主要是这里排版还该死地好看, 当年也花了好些时间改, 不能浪费. 哎, 到时候发现互联网多个旮旯都有我吱哇乱叫, 还是得有个地方有点正儿八经的东西. 真的是标点符号后打空格太习惯了, 我现在标点感觉只能用半角比较好了. 记起来了, 这里我用了那啥谁的开源标点符号排版的脚本来着, 符号咋打应该看起来问题不大. 我还是觉得哇, 那写出来了, 还能叫心里话吗. 不过我比较离谱, 我就算自己一个人在心里想给自己听, 感觉也不一定是心里话.


2023/3/29 Wed.

起因很简单, 刷帖子刷到建议国内数据分析建议转行卖淀粉肠, 朋友吐槽国内干数据分析就是在非洲卖羽绒服. 我快速写一写, 不能浪费太多时间, 不管通不通顺了, 我老能看懂我自己反正, 也算整理下思路, 常常不理我自己都不清楚. 当即想到怎么会这样呢, 当年 Fisher 被那啥农场请去分析数据, 他自己说是 "raking over the muck heap" -- 我一直记得这个表达 -- 他不仅翻出了东西, 他甚至把个学科建立起来了, 我就想这东西多多少少还是有点用吧, 哈哈哈, 想起来当年我可能还有点学术热情, 后来太难了, 我智商不够, 都怪我学艺不精, 还不努力. 回想起在爱丁堡, 睡不着的普通晚上, 就想我这么累死累活是为了啥啊, 肯定一点也没用, 以后一点也用不上, 那可能是我第n次的这种类型的现实打击, 想起当年第一次, 我可能还不信, 后来慢慢接受了, 但是那天晚上就是, 和所有搞大作业小作业啥的搞不完的人一样, 当场崩溃了感觉, 为啥这么辛苦学这些, 以后不能用, md, 委屈哭了大半夜的. 就前两天, 该是类似情况, 不过应该是因为没之前累, 多多少少是又长大了一年, 也才到难睡着的状态. 这是我该考虑的问题吗, 还说自己年纪大了, 看来还是太年轻. 不对, 我理清楚了些我觉得, 我天天不是在和数据打交道吗这, 主要问题就是我学艺不精, 没办法解决问题, 怎么是没啥用呢, 是我不会! 没有人家 Fisher 的天赋还没人家的努力, 可恶, 走了, 不瞎想了. 算了不正儿八经了, 我咋正儿八经啊, 不可能的, 又是一个吱哇乱叫的地方罢了. Fisher 没有你我怎么活啊! 最后一句: 肯定是学校培养方案的问题! 再加一句: 虽然可能不想承认, 最主要就是我自己的问题! 走了! 到时候找点时间整理下学习的东西. 就是太闲了我.


2023/4/11 Tues.

白写了, 又觉得以后会不会多少有点用.

import copy
import re

from treelib import Tree

def make_trie(field_list, comm_str_thresh=1):
    # _end = '_end_'

    if len(field_list) != len(set(field_list)):
        raise Exception("There are duplicated fields in the list.")

    field_list_formatted = [(i, format_field_name(i)) for i in field_list]
    field_list_formatted.sort(key=lambda a: a[1])
    print([i[1] for i in field_list_formatted])

    tree = Tree()
    tree.create_node(tag='ROOT', identifier='ROOT/')
    tree.create_node(tag='', identifier='ROOT', parent='ROOT/')

    for field, field_formatted in field_list_formatted:
        current_parent = 'ROOT/'
        tag_name = field_formatted

        while True:
            inode = 0
            current_children = tree.children(current_parent)
            for node in current_children:
                inode += 1
                old_node = copy.copy(node)
                comm_num, comm_str = get_common_head_str(tag_name, old_node.tag)

                # if include exactly the common part
                if comm_num == len(old_node.tag) and comm_num != 0 and comm_num >= comm_str_thresh:
                    tag_name = tag_name[comm_num:]
                    # update current_parent id. id: add the new field name.
                    tree.update_node(node.identifier, identifier=old_node.identifier + '/' + field)
                    current_parent = node.identifier
                    break

                # if common str exists, but not exactly the same.
                elif comm_num >= comm_str_thresh:
                    tag_name = tag_name[comm_num:]
                    # update old node. id: add new field name. tag: renew to the new common str.

                    # update old node's children. add a parent.
                    # add a node the same root with parent just added.
                    sub_tree = tree.remove_subtree(node.identifier)
                    sub_tree.update_node(node.identifier, tag=old_node.tag[comm_num:])
                    tree.create_node(identifier=old_node.identifier + '/' + field, tag=comm_str, parent=current_parent)
                    current_parent = old_node.identifier + '/' + field
                    tree.paste(current_parent, sub_tree)
                    break

            # print(field)
            # print(comm_num)
            # print(current_parent)
            # print('len(current_children)', len(current_children))
            # print([i.tag for i in current_children])
            # print('inode', inode, '\n')
            if inode == len(current_children) and comm_num < comm_str_thresh:
                break

        tree.create_node(identifier=field + '/', tag=tag_name, parent=current_parent)
        tree.create_node(identifier=field, tag='', parent=field + '/')
    return tree

    # ifield = 0
    # while ifield < list_len:
    #     jfield = ifield + 1
    #     while jfield < list_len:
    #         istr = field_list_formatted[ifield][1]
    #         jstr = field_list_formatted[jfield][1]
    #         comm_num, comm_str = get_common_head_str(istr, jstr)
    #         # if common length is larger than a gaven ratio of the longer string or
    #         # is the shorter string itself, these two fields are packed to one category tree.
    #         if comm_num >= comm_num_ratio * max(len(istr), len(jstr)) or comm_num == min(len(istr), len(jstr)):
    #             if comm_str not in tree.nodes.keys():
    #                 print(comm_str, istr[comm_num:], istr[comm_num:])
    #                 tree.create_node(comm_str, comm_str, parent='ROOT')
    #                 tree.create_node(istr[comm_num:], comm_str+'_'+istr, parent=comm_str)
    #                 tree.create_node(jstr[comm_num:], comm_str+'_'+jstr, parent=comm_str)
    #             else:
    #                 tree.create_node(jstr[comm_num:], jstr, parent=comm_str)
    #             jfield += 1
    #         else:
    #             break
    #     ifield = jfield

    # return tree

    # for field, field_formatted in field_list_formatted:
    #     current_tree = tree
    #     # For each field, traverse each nodes for any co
    #     for node in tree.nodes.keys():
    #         comm_num, comm_str = get_common_head_str(field_formatted, node)
    #         if comm_num >= comm_num_ratio * len(field_formatted) or comm_num == len(node):
    #             tree.create_node(comm_str, )

2023/5/21 Wed.

我觉得我得学一下软件工程。唉要学的东西太多了。

https://learn.lianglianglee.com/专栏/软件工程之美/01 到底应该怎样理解软件工程?.md

我觉得我技术博客就不要放非技术的东西了吧,虽然我也没啥技术。好了都不放首页,免得显得不务正业。

再来一句:gpt没有你我怎么活啊!gpt你带我走吧!

posted @ 2023-03-29 22:07  ZZN而已  阅读(69)  评论(0)    收藏  举报