124 research outputs found

    Making Python Code Idiomatic by Automatic Refactoring Non-Idiomatic Python Code with Pythonic Idioms

    Full text link
    Compared to other programming languages (e.g., Java), Python has more idioms to make Python code concise and efficient. Although pythonic idioms are well accepted in the Python community, Python programmers are often faced with many challenges in using them, for example, being unaware of certain pythonic idioms or do not know how to use them properly. Based on an analysis of 7,638 Python repositories on GitHub, we find that non-idiomatic Python code that can be implemented with pythonic idioms occurs frequently and widely. Unfortunately, there is no tool for automatically refactoring such non-idiomatic code into idiomatic code. In this paper, we design and implement an automatic refactoring tool to make Python code idiomatic. We identify nine pythonic idioms by systematically contrasting the abstract syntax grammar of Python and Java. Then we define the syntactic patterns for detecting non-idiomatic code for each pythonic idiom. Finally, we devise atomic AST-rewriting operations and refactoring steps to refactor non-idiomatic code into idiomatic code. We test and review over 4,115 refactorings applied to 1,065 Python projects from GitHub, and submit 90 pull requests for the 90 randomly sampled refactorings to 84 projects. These evaluations confirm the high-accuracy, practicality and usefulness of our refactoring tool on real-world Python code. Our refactoring tool can be accessed at 47.242.131.128:5000.Comment: 12 pages, accepted to ESEC/FSE'202

    Modified Dachengqi Tang improves decreased gastrointestinal motility in postoperative esophageal cancer patients

    Get PDF
    AbstractObjectiveTo investigate the clinical effects of modified Dachengqi Tang (DCQT) on promoting gastrointestinal motility in post-operative esophageal cancer patients.MethodsSixty postoperative esophageal cancer patients were enrolled and randomly assigned to the modified treatment group or the control group (30 patients in each group). Patients in the treatment group were given DCQT made from decocted herbs and administered via nasojejunal tube at a dosage of 150 mL. Gastrointestinal motility was assessed by recording time for recovery of bowel sounds, flatus, defecation, and the total amount of gastric drainage during the first three postoperative days. Plasma motilin (MTL) and vasoactive intestinal peptide (VIP) were measured one hour before and three days after surgery.ResultsCompared with the control group, the times to first bowel sound, flatus, and defecation were significantly shorter and there was less gastric drainage in the treatment group (P < 0.01, P < 0.01, P < 0.01, and P < 0.05, respectively). In the treatment group, postoperative plasma MTL was significantly higher (P < 0.01) and VIP was significantly lower than those in the control group (P < 0.05). There was no difference found in either MTL or VIP from before to after operation in the treatment group (P > 0.05). MTL was significantly lower and VIP was higher postoperatively in the control group, compared to before surgery (P < 0.01).ConclusionsModified DCQT effectively improved decreased gastrointestinal motility in postoperative esophageal cancer patients by increasing MTL and reducing VIP

    Internal Language Model Estimation Through Explicit Context Vector Learning for Attention-based Encoder-decoder ASR

    Full text link
    An end-to-end (E2E) ASR model implicitly learns a prior Internal Language Model (ILM) from the training transcripts. To fuse an external LM using Bayes posterior theory, the log likelihood produced by the ILM has to be accurately estimated and subtracted. In this paper we propose two novel approaches to estimate the ILM based on Listen-Attend-Spell (LAS) framework. The first method is to replace the context vector of the LAS decoder at every time step with a vector that is learned with training transcripts. Furthermore, we propose another method that uses a lightweight feed-forward network to directly map query vector to context vector in a dynamic sense. Since the context vectors are learned by minimizing the perplexities on training transcripts, and their estimation is independent of encoder output, hence the ILMs are accurately learned for both methods. Experiments show that the ILMs achieve the lowest perplexity, indicating the efficacy of the proposed methods. In addition, they also significantly outperform the shallow fusion method, as well as two previously proposed ILM Estimation (ILME) approaches on several datasets.Comment: Proceedings of INTERSPEEC

    Research progress in finite element analysis of ankle sprains

    Get PDF
    Ankle dislocation is the most common sports injury and is often associated with sports injuries. Among them, the tendon ligament causes damage to the posterior ankle ligament and the posterior ankle ligament. Important stabilizing structures, especially the anterior fibula ligament and the heelofibular ligament, play an important role in maintaining balance, and their injuries can lead to instability on the lateral side of the ankle. This seriously affects the function of the ankle. At the same time, it has a stabilizing effect on the lower joint, and its damage will also affect the function of the lower joint. [1-2] Foreign scientists have collected cases of acute fractures of the ankle joint, but only the central ligament rupture. Almost all injuries to the central tendon can cause a partial tear of the ligament. However, severe hallux valgus abuse can still lead to isolated damage to the triangular ligament. [3-4] Study surface emography and other techniques for basic ankle fracture studies to address the biomechanical and kinematic problems of ankle sprains. The biomechanics of ankle injuries will now be discussed in conjunction with the mechanisms of ankle injuries. To discuss the biomechanics and kinematics of ankle sprains

    Optimized Quantum Implementation of AES

    Get PDF
    In this paper, we research the implementation of the AES family with Pauli-X gates, CNOT gates and Toffoli gates as the underlying quantum logic gate set. First, we investigate the properties of quantum circuits and the influence of Pauli-X gates, CNOT gates and Toffoli gates on the performance of the circuits constructed with those gates. Based on the properties of quantum circuits as well as our observations on the classical ones built by Boyar \emph{et al.} and Zou \emph{et al.}, we research the construction of reversible circuits for AES\u27s Substitution-box (S-box) and its inverse (S-box−1^{-1}) by rearranging the classical implementation to three parts. Since the second part is treated as a 4-bit S-box in this paper and can be dealt with by existing tools, we propose a heuristic to search optimized reversible circuits for the first part and the third part. The application of our method reveals that the reversible circuits constructed for AES S-box and its inverse consume fewer qubits with optimized CNOT gate consumption and Toffoli depth. In addition, we study the construction of reversible circuits for the key schedule and the round function of AES by applying various number of S-boxes in parallel. As a result, we report quantum circuits of AES-128, AES-192 and AES-256 with 269, 333 and 397 qubits, respectively. If more qubits are allowed, quantum circuits that outperform state-of-the-art schemes in the metric of T⋅MT\cdot M value for the AES family can be reported, and it needs only 474, 538 and 602 qubits for AES-128, AES-192 and AES-256, respectively
    • …
    corecore