Skip to content

位于Project的Ramile文件夹项目中

介绍和链接

更新: 5/3/2025 字数: 0 字 时长: 0 分钟

luxel/ramile: China software copyright extraction tool - 中国软件著作权代码自动提取工具 (github.com)

  • 使用python 3.6.1编写的自动化脚本
  • 直接提取成标准的软著源代码文档

使用方法

更新: 5/3/2025 字数: 0 字 时长: 0 分钟

  • 安装python3和python3-pip
  • 从github上克隆该项目
git clone https://github.com/luxel/ramile.git
  • 进入项目目录,使用pip安装依赖
pip install -r requirements.txt
  • 运行python程序
python ramile-cli.py extract <path to your project root>
提取全部代码,结尾加一个INF
python ramile-cli.py extract <path to your project root> Inf
python ramile-cli.py extract D:\WebDownload\软著和专利\HXAWVS-main\HXAWVS-main

程序扩展

更新: 5/3/2025 字数: 0 字 时长: 0 分钟

原程序只能识别下图所示语言 ![[Pasted image 20240228151938.png]] 当需要识别更多语言时,我们需要在源码中手动添加 在,该程序的识别原理是对后缀进行识别,然后提取文件中的代码文件。

以识别python代码为例

  1. processors中新建一个py_processor.py
python
from ramile.processors import FileProcessorBase

from ramile.processors import BlankLineFilter

from ramile.processors.c_style_comment_block_filter import CStyleCommentBlockFilter

from ramile.processors.double_slash_comment_filter import DoubleSlashCommentFilter

from ramile.processors.html_comment_block_filter import HtmlCommentBlockFilter

  
  

class PythonProcessor(FileProcessorBase):
#主要修改[]中的内容,其他内容都是模板
    expected_extensions = ['.py']

  

    def __init__(self):

        self.filters.append(BlankLineFilter())

        self.filters.append(CStyleCommentBlockFilter())

        self.filters.append(DoubleSlashCommentFilter())

        self.filters.append(HtmlCommentBlockFilter())

        return
  1. __init__.py中添加相应的方法
  2. 运行ramile-cli.py

菜就多练

本站访客数 人次 本站总访问量