This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# coding: utf-8 | |
# # 学习 bean search | |
# | |
# ## ref | |
# | |
# [xueke.fm 束搜索](https://kexue.fm/archives/7500/comment-page-1) | |
# | |
# [C5W3L03 Beam Search - YouTube](https://www.youtube.com/watch?v=RLWuzLLSIgw) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.container{ | |
width: 500px; | |
display: flex; | |
flex-direction: column; | |
background: yellow; | |
text-align: center; | |
} | |
.container-eachline{ | |
margin-top: 10px; | |
margin-bottom: 10px; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.container{ | |
width: 500px; | |
display: flex; | |
flex-direction: column; | |
background: yellow; | |
} | |
.container-eachline{ | |
display: flex; | |
flex-direction: row; | |
margin-top: 10px; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# for each value(which is a dict) of input0, reorder the value dict in ascending order constructing output | |
import sys | |
assert float(sys.version[:3]) >= 3.7, """ | |
this code only available from python version 3.7, see following for detail | |
https://stackoverflow.com/questions/39980323/are-dictionaries-ordered-in-python-3-6/39980744 | |
dict orders its key-value pairs in insertation order | |
""" | |
input0 = { | |
'a':{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// in main.js | |
import Router from 'vue-Router' | |
vue.use(Router) | |
const originalPush = router.push | |
router.push = function(obj, ...params){ | |
const current = this.history.current | |
// console.log(this, current) | |
const currentPath = current.path | |
const prefix = "/simed/" | |
if(obj instanceof Object && obj['doNotHack'] !== true){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* recursively resolve children if exits | |
* obj = { | |
* name, | |
* icon, | |
* } ->{ | |
* ...obj, | |
* meta:{title:name, icon:icon} | |
* } | |
* @param Object obj |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from tqdm import tdqm | |
for i in tqdm(range(100)): | |
print(i) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# for splitting by regex see https://blog.csdn.net/programmer_at/article/details/77409507 | |
spliters = [ | |
r';', | |
] | |
reg = '(胰腺|肝脏)(.+)' | |
key_names=['部位','情况'] | |
text = '胰腺未见局灶性占位。; 肝脏未见明显局灶性占位。;yes' | |
import re | |
def f(spliters, reg, key_names, text, throw_on_unmatch = False): | |
arr = re.split('|'.join( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://stackoverflow.com/questions/89228/calling-an-external-command-in-python | |
import subprocess | |
subprocess.run(["ls", "-l"]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class To_Number: | |
def __init__(self, start_of_index = 0, ): | |
self.end_of_index = start_of_index | |
self.start_of_index = start_of_index | |
self.dict={} | |
self.decode_dict={} | |
def add(self, ele): | |
if ele not in self.dict: | |
self.dict[ele] = self.end_of_index | |
self.decode_dict[self.end_of_index] = ele |
NewerOlder