🚀 Law Text2Vec
This model is used to calculate the similarity of legal texts and can be used to create vector databases, etc.
🚀 Quick Start
The Law Text2Vec model is designed for calculating the similarity of legal texts. It can be used in various legal text processing scenarios, such as building vector databases.
✨ Features
- Legal Text Similarity Calculation: Specifically designed for legal texts, it can accurately calculate the similarity between different legal statements.
- Based on Large-scale Legal Datasets: Trained on a large dataset of 936,727 national case records, ensuring the model's generalization ability.
📦 Installation
The README does not provide installation steps, so this section is skipped.
📚 Documentation
Dataset
This model is trained on a dataset of 936,727 national case records. Here are some samples from the dataset:
sentence1 |
sentence2 |
score |
If the two parties to a share transfer contract fail to reach an agreement on the transfer consideration, resulting in the non - enforceability of the signed share transfer agreement, the transfer agreement shall be deemed not to be established. |
The shareholders' meeting resolution of a limited liability company confirms the relevant matters of share transfer between relevant shareholders, but the transfer price is not clearly stipulated. If the parties cannot reach a supplementary agreement, shall the share transfer contract between the disputing shareholders be deemed established? |
1 |
Whether the non - compliance of the leased house with fire safety requirements can lead to the failure to achieve the contract purpose and whether the contract is of course invalid. |
The original trial held that the two defendants, as lessees, leased a general house. Both parties were aware of the leased property, and the subject matter met the contract requirements. The leased house had problems such as insufficient fire separation distance from adjacent buildings and insufficient width of evacuation passages. The fire separation distance from adjacent buildings and the width of evacuation passages of the subject matter did not meet the national standards. After the lessees obtained the leased house for hotel operation, the fire safety requirements were increased, but it was not inevitable that the contract purpose could not be achieved, so the invalidity of the contract was not supported. The retrial held that since the leased house had been used as a service - oriented business place after its completion, the fire safety problems mentioned in this case existed to varying degrees. However, there was no record of administrative departments prohibiting its operation before. The notice from the public security fire department this time was for rectification, not for prohibiting operation. According to the "Regulations on Fire Supervision and Administration of Construction Projects" promulgated by the Ministry of Public Security in 2012, the scope of mandatory fire safety requirements applies to buildings below 50 meters. That is, the establishment of a contract relationship with the house as the leased property does not violate the mandatory provisions of the state. Referring to the relevant opinions in the reply [2003] Min Yi Ta Zi No. 11 of the Supreme People's Court on "How to Determine the Validity of a House Lease Contract Concluded without Fire Acceptance", it was determined that the lease contract signed by both parties was established and valid. |
1 |
Examples
Question: How to define the common property between husband and wife?
- Interpretation (III) of the Supreme People's Court on Several Issues Concerning the Application of the "Marriage Law" (2011 - 08 - 09): Article 5. The income generated by a spouse's personal property after marriage, except for fruits and natural appreciation, shall be deemed as the common property of the husband and wife.
- Supplementary Provisions to the Interpretation (II) of the Supreme People's Court on Several Issues Concerning the Application of the "Marriage Law" (2017 - 02 - 28): Article 19. For a house leased by one party before marriage and purchased with common property after marriage, if the house ownership certificate is registered in the name of one party, it shall be deemed as the common property of the husband and wife.
- Supplementary Provisions to the Interpretation (II) of the Supreme People's Court on Several Issues Concerning the Application of the "Marriage Law" (2017 - 02 - 28): Article 22. Before the marriage of the parties, if the parents contribute to the purchase of a house for both parties, such contribution shall be deemed as a personal gift to their own child, unless the parents clearly indicate that it is a gift to both parties. After the marriage of the parties, if the parents contribute to the purchase of a house for both parties, such contribution shall be deemed as a gift to both the husband and wife, unless the parents clearly indicate that it is a gift to one party.
Question: What are the restrictions on the interest of private lending?
- Contract Law (1999 - 03 - 15): Article 206. The borrower shall repay the loan within the agreed term. If the loan term is not agreed or is not clearly agreed, and it cannot be determined in accordance with Article 61 of this Law, the borrower may repay the loan at any time; the lender may urge the borrower to repay the loan within a reasonable term.
- Contract Law (1999 - 03 - 15): Article 205. The borrower shall pay the interest within the agreed term. If the term for paying the interest is not agreed or is not clearly agreed, and it cannot be determined in accordance with Article 61 of this Law, if the loan period is less than one year, the interest shall be paid together with the repayment of the loan; if the loan period is more than one year, the interest shall be paid at the end of each full - year period, and if the remaining period is less than one year, the interest shall be paid together with the repayment of the loan.
- Provisions of the Supreme People's Court on Several Issues Concerning the Application of Law in the Trial of Private Lending Cases (2020 - 08 - 19): Article 26. Where the lender requests the borrower to pay interest at the contract - agreed interest rate, the people's court shall support it, except that the interest rate agreed by both parties exceeds four times the one - year loan prime rate at the time of contract conclusion. The "one - year loan prime rate" mentioned in the preceding paragraph refers to the one - year loan prime rate published monthly by the National Inter - bank Funding Center authorized by the People's Bank of China since August 20, 2019.
💻 Usage Examples
Basic Usage
from sentence_transformers import SentenceTransformer, LoggingHandler, losses, models, util
from sentence_transformers.util import cos_sim
model_path = "your_model_path"
model = SentenceTransformer(model_path).cuda()
sentence1 = "合同法(1999-03-15): 第二百零六条 借款人应当按照约定的期限返还借款。对借款期限没有约定或者约定不明确,依照本法第六十一条的规定仍不能确定的,借款人可以随时返还;贷款人可以催告借款人在合理期限内返还。"
sentence2 = "请问如果借款没还怎么办。"
encoded_sentence1 = model.encode(sentence1)
encoded_sentence2 = model.encode(sentence2)
print(cos_sim(encoded_sentence1, encoded_sentence2))
📄 License
This project is licensed under the Apache-2.0 license.
📚 Citation
Please feel free to cite us:
@misc{cui2023chatlaw,
title={ChatLaw: Open-Source Legal Large Language Model with Integrated External Knowledge Bases},
author={Jiaxi Cui and Zongjian Li and Yang Yan and Bohua Chen and Li Yuan},
year={2023},
eprint={2306.16092},
archivePrefix={arXiv},
primaryClass={cs.CL}
}
@misc{ChatLaw,
author={Jiaxi Cui and Zongjian Li and Yang Yan and Bohua Chen and Li Yuan},
title={ChatLaw},
year={2023},
publisher={GitHub},
journal={GitHub repository},
howpublished={\url{https://github.com/PKU-YuanGroup/ChatLaw}},
}